Search Results for

    Show / Hide Table of Contents

    Class ViewDescriptorInstance

    A class responsible for holding the description of an instance of a IModelView to be created within a layout

    This includes an custom parameters for the view itself along with parameters for the type of view

    Inheritance
    System.Object
    ViewDescriptorInstance
    Implements
    ICloneable
    ICloneable<ViewDescriptorInstance>
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Client.Core.Views.Core
    Assembly: ClientCore.dll
    Syntax
    [DataContract(IsReference = true)]
    public class ViewDescriptorInstance : ICloneable, ICloneable<ViewDescriptorInstance>

    Properties

    AllDescriptors

    A global list of the view descriptors for all valid view types within the system

    For internal use only, do not alter these.

    Declaration
    public static IEnumerable<ViewDescriptorInstance> AllDescriptors { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ViewDescriptorInstance>

    DisplayableItemType

    The type of item this view accepts as a valid object to work with and is valid to be passed into the DisplayItem(Object) method

    Declaration
    public Type DisplayableItemType { get; set; }
    Property Value
    Type Description
    System.Type

    IconID

    An icon to use when displaying the view in the displayer ui

    Declaration
    public Guid IconID { get; set; }
    Property Value
    Type Description
    System.Guid

    Name

    The user friendly name of this view seen by the user in the layout displayer

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    Param

    The standard parameters for the view itself including visibility options

    This class can be inherited by views to provide additional custom properties for each view as required

    Declaration
    public ViewSerializedParam Param { get; set; }
    Property Value
    Type Description
    ViewSerializedParam

    Parent

    The parent view for this view. The view must be in the same layout definition.

    When the parent view changes its SelectedItemForSubViews, the IModelLayoutDisplayer will pass that new item to this view to display

    Declaration
    public ViewDescriptorInstance Parent { get; set; }
    Property Value
    Type Description
    ViewDescriptorInstance

    SelectableType

    The type of item this view can select and return for dependant sub views through SelectedItemForSubViews

    Declaration
    public Type SelectableType { get; set; }
    Property Value
    Type Description
    System.Type

    ViewControllerName

    Optional - The name of the controller associated with the view to be created

    This provides the ability for you to provide a custom controller for a standard view by inheriting the controller, and specify its name here so the view uses that controller instead of the standard one

    Declaration
    public string ViewControllerName { get; set; }
    Property Value
    Type Description
    System.String

    ViewCreationParam

    Optional parameters used by CreateView(ViewDescriptorInstance) to determine the exact instance of the IModelView to create

    Declaration
    public string ViewCreationParam { get; set; }
    Property Value
    Type Description
    System.String

    ViewType

    The IModelView type of the actual view

    Declaration
    public Type ViewType { get; set; }
    Property Value
    Type Description
    System.Type

    Methods

    CanDisplayItem(Object)

    Evaluates if the specified object is valid to be displayed against this view type as determined by the DisplayableItemType property

    Declaration
    public bool CanDisplayItem(object item)
    Parameters
    Type Name Description
    System.Object item

    The type of item to see if it is valid to display against this view

    Returns
    Type Description
    System.Boolean

    True if the specified object is valid to be displayed against this view type as determined by the DisplayableItemType property

    Clone()

    Declaration
    public ViewDescriptorInstance Clone()
    Returns
    Type Description
    ViewDescriptorInstance

    CopyFromSource(ViewDescriptorInstance)

    Declaration
    public void CopyFromSource(ViewDescriptorInstance source)
    Parameters
    Type Name Description
    ViewDescriptorInstance source

    CreateView(IModelLayoutDisplayer)

    Creates an instance of the IModelView described by this view descriptor instance in the specified layout displayer

    If the creation of the view fails (because it has not been implemented in the client application) then the system will first attempt to create any view specified through the CreateViewFallback(Type, Type, String) method.

    If that fails, or there is no fallback specified, then it will return a standard error view with the message of the error instead
    Declaration
    public IModelView CreateView(IModelLayoutDisplayer displayer)
    Parameters
    Type Name Description
    IModelLayoutDisplayer displayer

    The layout displayer that will host the created view

    Returns
    Type Description
    IModelView

    An instance of the view created in the client application UI

    CreateViewFallback(Type, Type, String)

    An override to provide a different view to use when loading a display where the CreateView(ViewDescriptorInstance) call fails as it has not been implemented in that specific client application ui.

    By providing an alternative this CreateView(IModelLayoutDisplayer) method will attempt to create that view instead if the original fails

    This is used for providing more feature rich graphical views that can be replaced by grid versions if the graphical UI has not been implemented in the client such as in the console application
    Declaration
    public static void CreateViewFallback(Type viewType, Type fallBack, string fallBackViewCreationParams)
    Parameters
    Type Name Description
    System.Type viewType

    The type of view to provide a fall back for if the initial specified one fails

    System.Type fallBack

    The type of view to create instead of the viewType should it fail

    System.String fallBackViewCreationParams

    The optional serialized parameters to use for the ViewCreationParam when creating the fallBack view

    FromView(Type, String, ViewDescriptorInstance, String, Type)

    Declaration
    public static ViewDescriptorInstance FromView(Type viewType, string viewCreationParam = "", ViewDescriptorInstance parent = null, string controllerName = "", Type displayableType = null)
    Parameters
    Type Name Description
    System.Type viewType
    System.String viewCreationParam
    ViewDescriptorInstance parent
    System.String controllerName
    System.Type displayableType
    Returns
    Type Description
    ViewDescriptorInstance

    FromView<T>(String, ViewDescriptorInstance, String, Type)

    Returns the system view descriptor instance of the view from the specified parameters

    This is used instead of creating a ViewDescriptor from scratch as this automatically correctly fills out the DisplayableItemType, Name and other properties by default so you do not have to

    Declaration
    public static ViewDescriptorInstance FromView<T>(string viewCreationParam = "", ViewDescriptorInstance parent = null, string controllerName = "", Type displayableType = null)
        where T : IModelView
    Parameters
    Type Name Description
    System.String viewCreationParam

    An optional parameter to use when the CreateView(ViewDescriptorInstance) method actually creates the view. See each IModelView type for a description of valid parameters

    ViewDescriptorInstance parent

    An optional instance of the view descriptor that is the parent of this one

    System.String controllerName

    An optional name for the controller to use when creating the controller automatically for this view. If null the default one will be used.

    System.Type displayableType

    An optional type this view should work against. If null the default type for the view will be used.

    Returns
    Type Description
    ViewDescriptorInstance

    A newly created view descriptor instance that fully describes the type of view that should be created by the system in a layout

    Type Parameters
    Name Description
    T

    Indicates the type of IModelView to return a view descriptor for

    Remarks

    For instance to return the view descriptor for a message view:

    var view = ViewDescriptorInstance.FromView(typeof(IMessageView));
    view.Param = new MessageViewParams() { Message = $"Some custom message for the view."};

    Explicit Interface Implementations

    ICloneable.Clone()

    Declaration
    object ICloneable.Clone()
    Returns
    Type Description
    System.Object

    ICloneable.CopyFromSource(Object)

    Declaration
    void ICloneable.CopyFromSource(object source)
    Parameters
    Type Name Description
    System.Object source

    Implements

    ICloneable
    ICloneable<T>

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.