Class PropertyMediaControlBase<T>
Defines the base class for a PropertyMediaControl
Inheritance
Namespace: ImageVault.EPiServer
Assembly: ImageVault.EPiServer.dll
Syntax
public abstract class PropertyMediaControlBase<T> : PropertyDataControl where T : class, new()
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
PropertyMediaControlBase()
Declaration
protected PropertyMediaControlBase()
Fields
Log
Gets the Log of the PropertyMediaControlBase<T>
Declaration
protected static readonly ILog Log
Field Value
| Type | Description |
|---|---|
| ILog |
Properties
CurrentSettings
Gets the CurrentSettings of the PropertyMediaControlBase
Declaration
public PropertyMediaSettings CurrentSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMediaSettings |
EditControlTable
Used to store a reference to the edit control collection in the event of validation errors.
Declaration
protected HtmlGenericControl EditControlTable { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Web.UI.HtmlControls.HtmlGenericControl |
TargetHeight
Gets the TargetHeight of the PropertyMediaControlBase
Declaration
protected int TargetHeight { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
TargetResizeMode
Gets the TargetResizeMode of the PropertyMediaControlBase
Declaration
protected ResizeMode TargetResizeMode { get; }
Property Value
| Type | Description |
|---|---|
| ResizeMode |
TargetWidth
Gets the TargetWidth of the PropertyMediaControlBase
Declaration
protected int TargetWidth { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ThumbnailFormatUtil
Declaration
public abstract ThumbnailFormatUtil ThumbnailFormatUtil { get; }
Property Value
| Type | Description |
|---|---|
| ThumbnailFormatUtil |
Value
Gets the Value of the PropertyMediaControlBase
Declaration
protected T Value { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
AddErrorValidator(String)
Does exactly the same thing as the base class implementation with one change. It attds the validator control to the _validationCell instead
Declaration
public override void AddErrorValidator(string errorMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | errorMessage |
CreateDefaultControls()
Creates ImageVault default view If no valid license for the core service can be found, no image is displayed.
Declaration
public override void CreateDefaultControls()
CreateDefaultControlsInner()
Creates ImageVault controls default view
Declaration
protected abstract void CreateDefaultControlsInner()
CreateMediaCacheItem(MediaItem, Nullable<Int32>)
Creates a MediaCacheItem from the supplied mediaItem
Declaration
protected MediaCacheItem CreateMediaCacheItem(MediaItem mediaItem, int? thumbnailFormatId = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaItem | mediaItem | The MediaItem to create the item from |
| System.Nullable<System.Int32> | thumbnailFormatId |
Returns
| Type | Description |
|---|---|
| MediaCacheItem | The created MediaCacheItem |
Remarks
The MediaItem must have two MediaConversions where one is the format that is supplied as thumbnail and the other is the original format.
CreateOnPageEditControls()
Create the OnPageEditControls
Declaration
public override void CreateOnPageEditControls()
DataToString()
Returns a System.String that represents the current PropertyMediaControlBase<T>.
Declaration
protected abstract string DataToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the current PropertyMediaControlBase<T>. |
GetExceptionErrorMessageString(Exception)
Returns an appropriate error description, based on the exception.
Declaration
public static string GetExceptionErrorMessageString(Exception ex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | ex | The thrown exception |
Returns
| Type | Description |
|---|---|
| System.String | Error message |
GetPreviewHtml(MediaReference)
Calculates the Html for the preview item
Declaration
public string GetPreviewHtml(MediaReference mediaReference)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaReference | mediaReference | The MediaReference to get html for |
Returns
| Type | Description |
|---|---|
| System.String |
GetPropertySettingsFromModel()
Gets the registered PropertySettings for the property
Declaration
protected PropertyMediaSettings GetPropertySettingsFromModel()
Returns
| Type | Description |
|---|---|
| PropertyMediaSettings | The registered settings or null if none where found |
GetPropertySettingsFromView()
Checks the attributes from the view and returns a settings object if any settings are found
Declaration
protected PropertyMediaSettings GetPropertySettingsFromView()
Returns
| Type | Description |
|---|---|
| PropertyMediaSettings | A PropertyMediaSettings instance or null if no settings where found in the view |
GetPublishedMediaHtml(MediaReference, PropertyMediaSettings)
Get the media html according to the supplied settings.
Declaration
protected string GetPublishedMediaHtml(MediaReference mediaReference, PropertyMediaSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaReference | mediaReference | The MediaReference to get html for |
| PropertyMediaSettings | settings | The PropertyMediaSettings containing the settings for the output format |
Returns
| Type | Description |
|---|---|
| System.String | The html to use for displaying the media or null if no media was found |
GetThumbnailFormatWithEffect(Effect)
Gets a ThumbnailFormat from the Core that uses the supplied effect.
Declaration
[Obsolete("Use MediaFormatUtil.GetThumbnailFormatWithEffects instead")]
protected ThumbnailFormat GetThumbnailFormatWithEffect(Effect effect)
Parameters
| Type | Name | Description |
|---|---|---|
| Effect | effect | The Effect to use |
Returns
| Type | Description |
|---|---|
| ThumbnailFormat | The existing ThumbnailFormat from core. |
IsEditable(MediaCacheItem)
Checks if a specific mediaCache is editable or not.
Declaration
protected bool IsEditable(MediaCacheItem mediaCache)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaCacheItem | mediaCache |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is editable, otherwise false. |
Remarks
We can only edit images and only if the image is larger than the target settings (for fit, we allow one dimension to be equal or smaller than the target)
OnPreRender(EventArgs)
Thumbnails must be set in this stage. Value can differ from the current value
Declaration
protected override void OnPreRender(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
RegisterCssFile(String)
Registers the CSS file.
Declaration
protected void RegisterCssFile(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | The path. |
RenderThumbnails(ref T, String, String, DisplayChannelSetting)
Renders the thumbnails on the supplied value
Declaration
public abstract string RenderThumbnails(ref T value, string virtualPath, string thumbnailCache, DisplayChannelSetting setting)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to use as |
| System.String | virtualPath | The virtualPath of the EPiserver plugin |
| System.String | thumbnailCache | The value retrieved from the thumbnail cache. This list should always be used unless it is null or empty |
| DisplayChannelSetting | setting |
Returns
| Type | Description |
|---|---|
| System.String | The new value for the thumbnailCache that should be used. |
Remarks
This method is called when the UI should be updated to reflect the current selected media. The value represents the value that should be rendered and the thumbnail cache represents the values for the thumbnails that should be used. If that value is missing, then use the supplied value to calculate the url:s for the thumbnails.
StringToData(String)
Converts the supplied string to an object
Declaration
protected abstract object StringToData(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | This string comes from the postback from the edit mode |
Returns
| Type | Description |
|---|---|
| System.Object | The object that the string represents or null if no data is entered |
Translate(String)
Translates the supplied
Declaration
protected static string Translate(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key |
Returns
| Type | Description |
|---|---|
| System.String |