Search Results for

    Show / Hide Table of Contents

    Class ModelViewController

    The base controller to be used against all IModelView views in the system

    Inheritance
    System.Object
    ModelViewController
    ButtonController
    ImageController
    MessageController
    BaseDefaultSingleViewController<T>
    BaseGridController
    BaseTreeViewController<T>
    ChartViewController
    ModelToolWindowController
    PivotViewController
    EntitySchemaController
    EntityStructureController
    Implements
    IModelViewController
    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
    public abstract class ModelViewController : IModelViewController

    Constructors

    ModelViewController(IModelView)

    Creates a new model view controller for the provided view from the client application ui

    Declaration
    public ModelViewController(IModelView view)
    Parameters
    Type Name Description
    IModelView view

    The view this controller is responsible for

    Properties

    CanWrite

    Indicates if the user currently has permissions to edit the displayed item

    Default to false if the main displayed item for this layout has read only set to true (ReadOnly). Or loads the permissions for the item

    Declaration
    public virtual bool CanWrite { get; }
    Property Value
    Type Description
    System.Boolean

    CheckIsLockedForCanWrite

    Indicates the controller should check if the item is locked before allowing CanWrite to be true. Defaults to true.

    Declaration
    protected virtual bool CheckIsLockedForCanWrite { get; }
    Property Value
    Type Description
    System.Boolean

    Commands

    A list of all the custom commands that should be displayed in the client application alongside the View

    Declaration
    public IEnumerable<ViewCommand> Commands { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ViewCommand>

    ContextHelpURL

    An optional associated url of a help file for the view this controller works with

    Declaration
    public virtual string ContextHelpURL { get; }
    Property Value
    Type Description
    System.String

    CurrentDisplayedItem

    The current item being displayed against the View. This is the item last called with DisplayableItemDescriptor

    Declaration
    public object CurrentDisplayedItem { get; }
    Property Value
    Type Description
    System.Object

    DisplayIfNull

    Indicates that even if the item is null the view should still update and display a null value. Default value is false.

    Declaration
    public virtual bool DisplayIfNull { get; }
    Property Value
    Type Description
    System.Boolean

    SelectedItemForSubViews

    Returns the item this view holds that can be passed to sub views

    This controller can change the item is passes to sub views (such as when this represents the selected item in a grid) by calling UpdateSubViews(IModelView)

    Declaration
    public virtual object SelectedItemForSubViews { get; }
    Property Value
    Type Description
    System.Object

    TrackItemChanges

    Indicates that this controller should be notified of changes made to any tracked item in this context via the OnTrackedItemChanged(Object, String)

    Declaration
    public virtual bool TrackItemChanges { get; }
    Property Value
    Type Description
    System.Boolean

    View

    The view instance this controller is working with

    Declaration
    public IModelView View { get; }
    Property Value
    Type Description
    IModelView

    Methods

    AddHandlers(Object)

    Provides the implementing class an opportunity to add any handlers from the item before it is displayed by this controller

    Declaration
    protected virtual void AddHandlers(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to add any handlers to

    Clear()

    Clears the associated View back to an initial blank state

    Declaration
    public virtual Task Clear()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    CloseController()

    Called when a view is being closed, and before the controller is disposed.

    Used to dispose of associated commands and clear the view

    Declaration
    public virtual Task CloseController()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    DisplayItem(Object)

    Clears the view, determines if CanWrite is true, and if it ShouldDisplayItem(Object) then calls AddHandlers(Object) and DisplayUI()

    Declaration
    public virtual Task DisplayItem(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to be displayed against this View

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    DisplayUI()

    Must be implemented by the inheriting class to perform the operation of displaying the CurrentDisplayedItem against the View

    Declaration
    public abstract Task DisplayUI()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    InitAsync()

    Provides the controller a chance to initialize any dependant data. Called once by the system after controller creation.

    Declaration
    public virtual Task InitAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    InitCommands(IList<ViewCommand>)

    Provides the inheriting class an opportunity to add custom commands to this controller

    Declaration
    protected virtual void InitCommands(IList<ViewCommand> commands)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<ViewCommand> commands

    The current set of commands for this controller

    InsertCommand(ViewCommand, ViewCommand, ViewCommand)

    Inserts the specified command either directlyBefore the specified command, directlyAfter the specified command, or just added to the end

    Declaration
    public virtual void InsertCommand(ViewCommand command, ViewCommand directlyAfter = null, ViewCommand directlyBefore = null)
    Parameters
    Type Name Description
    ViewCommand command

    The command to insert into the existing set of commands for this controller

    ViewCommand directlyAfter

    The command this command should be inserted directly after

    ViewCommand directlyBefore

    The command this command should be inserted directly before

    InsertCommand(ViewCommand, Int32)

    Inserts the specified command into the set of commands for this controller at the specified index location

    Declaration
    public virtual void InsertCommand(ViewCommand command, int index)
    Parameters
    Type Name Description
    ViewCommand command

    The command to add to the list of commands for this controller

    System.Int32 index

    The index location of the command to be added to the existing list of commands for this controller

    OnTrackedItemChanged(Object, String)

    Provides the inheriting class the opportunity to react to any changed item in the context this View operates within

    Declaration
    protected virtual void OnTrackedItemChanged(object item, string propName)
    Parameters
    Type Name Description
    System.Object item

    The item that has changed

    System.String propName

    The name of the property on the item that changed

    Redisplay()

    Indicates the system should redisplay the CurrentDisplayedItem against the view again.

    Usually a User initiated operation

    Declaration
    public virtual Task Redisplay()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    RemoveCommand(ViewCommand)

    Removes the specified command from the set of commands for this controller

    Declaration
    public void RemoveCommand(ViewCommand command)
    Parameters
    Type Name Description
    ViewCommand command

    The command to remove from the set of commands for this controller

    RemoveCommands<OFType>()

    Removes all commands of the specified type OFType from the set of commands for this controller

    Declaration
    public void RemoveCommands<OFType>()
        where OFType : ViewCommand
    Type Parameters
    Name Description
    OFType

    The type of commands to remove from the set of commands for this controller

    RemoveHandlers(Object)

    Provides the implementing class an opportunity to remove any handlers from the item before its reference is removed from this controller

    Declaration
    protected virtual void RemoveHandlers(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to remove any handlers from

    ShouldDisplayItem(Object)

    Indicates if this item should be displayed against this view

    By default this returns true if the item is not null or DisplayIfNull is true

    Declaration
    protected virtual bool ShouldDisplayItem(object item)
    Parameters
    Type Name Description
    System.Object item

    The item to check if it should be displayed against the View

    Returns
    Type Description
    System.Boolean

    True if this item should be displayed against this view

    UpdateAllCommands()

    Enumerates all the commands for this controller and calls OnCanExecuteChanged()

    Used by the view to update the disabled/enabled state of all commands on the view when dependant data changes within the view itself

    Declaration
    public virtual void UpdateAllCommands()

    Implements

    IModelViewController

    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.