Class ModelLayoutHostController
The main controller for any IModelLayouHost view which can contain multiple instances of IModelLayoutDisplayer
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Core
Assembly: ClientCore.dll
Syntax
public class ModelLayoutHostController : IController
Constructors
ModelLayoutHostController(IModelLayouHost)
Creates a new ModelLayoutHostController for the specified IModelLayouHost
Declaration
public ModelLayoutHostController(IModelLayouHost displayer)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayouHost | displayer | The host client application ui that this controller uses for interacting with the application |
Properties
ActiveLayout
The currently active layout the user is interacting with in this Displayer
Declaration
public IModelLayoutDisplayer ActiveLayout { get; }
Property Value
| Type | Description |
|---|---|
| IModelLayoutDisplayer |
ActiveNonToolWindowLayout
The currently active layout that is a tool window that the user is interacting with in this Displayer
Declaration
public IModelLayoutDisplayer ActiveNonToolWindowLayout { get; }
Property Value
| Type | Description |
|---|---|
| IModelLayoutDisplayer |
Displayer
The ui in the client application that hosts multiple instances of a IModelLayoutDisplayer
Declaration
public IModelLayouHost Displayer { get; }
Property Value
| Type | Description |
|---|---|
| IModelLayouHost |
Layouts
All the current loaded layouts hosted within the Displayer
Declaration
public IEnumerable<IModelLayoutDisplayer> Layouts { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IModelLayoutDisplayer> |
NonToolWindowLayouts
All the layouts hosted within the Displayer that are not tool windows (that operate on the active layout and are identified as having a MainDisplayedItem of type DisplayableItemDescriptorForToolWindow)
Declaration
public IEnumerable<IModelLayoutDisplayer> NonToolWindowLayouts { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IModelLayoutDisplayer> |
OwningWindow
The owning window this Displayer is hosted within
Declaration
public IWindow OwningWindow { get; }
Property Value
| Type | Description |
|---|---|
| IWindow |
Methods
CanOpenToLayout(EntityDescriptor)
Returns true if there is a default (DefaultLayoutGenerator), or custom (ILayout), layout for displaying a collection or single item of the specified entity type
The collection grid is allowed instead of just a single item one, as the collection can be filtered by the system to just the single item, allowing the system to display a single item in the default grid or single view depending on what is available
Declaration
public static Task<bool> CanOpenToLayout(EntityDescriptor desc)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityDescriptor | desc | The type of entity to check if there is a default layout for a collection or single entity type |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> | True if there is a default (DefaultLayoutGenerator), or custom (ILayout), layout for displaying a collection or single item of the specified entity type |
Clear()
Provides any inheriting classes an opportunity to clear the Displayer. Typically disposes of any main menu commands
Declaration
public virtual void Clear()
CloseLayout(IModelLayoutDisplayer, Boolean)
Closes the specified layout, removes it from the Displayer, disposes of it and return true if the layout was removed
If silent is false, and the layout has pending changes within its context then this will first prompt the user to continue, save or cancel. If the user selects cancel or the save fails then false is returned.
Declaration
public Task<bool> CloseLayout(IModelLayoutDisplayer layout, bool silent = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutDisplayer | layout | The layout to be closed, and removed from the Displayer |
| System.Boolean | silent | If true means any pending changes should be ignored and disposed. If false and the layout has pending changes then it will prompt the user what to do before closing the layout |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> | True if the layout was closed, or false if the user cancelled or a save failed |
IsToolWindowLayout(IModelLayoutDisplayer)
Returns true if the specified layout is a tool window which operates on the active layout and has a MainDisplayedItem of type DisplayableItemDescriptorForToolWindow
Declaration
public bool IsToolWindowLayout(IModelLayoutDisplayer layout)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutDisplayer | layout | The layout to identify if it is a tool window or not |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the specified layout is a tool window which operates on the active layout and has a MainDisplayedItem of type DisplayableItemDescriptorForToolWindow |
OpenItem(IModelLayoutCommon, IBaseEntity, IEntityUpdaterUI)
Opens the speficied item as a new layout in the provided host.
If no con is provided and changes have occcured in this context, then the item will be opened in the same context sharing it, otherwise it will be opened in a new context
itemSource will need to be reloaded into the new context being used, otherwise it is assumed to already be a part of the existing context
Declaration
public static Task OpenItem(IModelLayoutCommon host, IBaseEntity itemSource, IEntityUpdaterUI con = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutCommon | host | The host that this is being opened from, and that the new layout should be added to |
| IBaseEntity | itemSource | The instance of the item to open. If the item is opened in a new context then this item will need to be reloaded into the new context being used, otherwise it is assumed to already be a part of the existing context |
| IEntityUpdaterUI | con | An optional context that the item should be opened within. If null the item may still be opened in the existing context if it has pending changes, otherwise a new context will be created for the opened layout |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation |
OpenItem(IModelLayoutCommon, IBaseEntity, IEntityUpdaterUI, Nullable<Guid>)
Opens the speficied item as a new layout in the provided host with an optional custom ILayout override
If no con is provided and changes have occcured in this context, then the item will be opened in the same context sharing it, otherwise it will be opened in a new context
itemSource will need to be reloaded into the new context being used, otherwise it is assumed to already be a part of the existing context
Declaration
public static Task OpenItem(IModelLayoutCommon host, IBaseEntity itemSource, IEntityUpdaterUI con, Guid? customLayoutOverrideID)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutCommon | host | The host that this is being opened from, and that the new layout should be added to |
| IBaseEntity | itemSource | The instance of the item to open. If the item is opened in a new context then this item will need to be reloaded into the new context being used, otherwise it is assumed to already be a part of the existing context |
| IEntityUpdaterUI | con | An optional context that the item should be opened within. If null the item may still be opened in the existing context if it has pending changes, otherwise a new context will be created for the opened layout |
| System.Nullable<System.Guid> | customLayoutOverrideID | The unique global id of an ILayout that holds a custom layout to use instead of the default one |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation |
OpenItem(IModelLayoutCommon, Type, Guid, IEntityUpdaterUI)
Opens the specified item as a new layout in the provided host
If no con is provided and changes have occcured in this context, then the item will be opened in the same context sharing it, otherwise it will be opened in a new context
Declaration
public static Task OpenItem(IModelLayoutCommon host, Type type, Guid id, IEntityUpdaterUI con = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutCommon | host | The host that this is being opened from, and that the new layout should be added to |
| System.Type | type | The type of the entity to open (either the interface or class type) |
| System.Guid | id | The unique id of the entity to open |
| IEntityUpdaterUI | con | An optional context that the item should be opened within. If null the item may still be opened in the existing context if it has pending changes, otherwise a new context will be created for the opened layout |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation |
OpenRelatedItem(IModelLayoutCommon, Object, String)
Opens the related item from the specified idBinding property on the itemSource as a new layout in the provided host
If changes have occcured in this context, then the item will be opened in the same context sharing it, otherwise it will be opened in a new context
Declaration
public static Task OpenRelatedItem(IModelLayoutCommon host, object itemSource, string idBinding)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutCommon | host | The host of the current item that this is being opened from, and that the new layout should be added to |
| System.Object | itemSource | The item containing the id (on the |
| System.String | idBinding | The name of the property on the |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation |
OpenRelatedItem(IModelLayoutCommon, Object, String, EntityDescriptor, IEntityUpdaterUI)
Opens the related item from the specified idBinding property on the itemSource as a new layout in the provided host
If no con is provided and changes have occcured in this context, then the item will be opened in the same context sharing it, otherwise it will be opened in a new context
Declaration
public static Task OpenRelatedItem(IModelLayoutCommon host, object itemSource, string idBinding, EntityDescriptor toOpenType, IEntityUpdaterUI con = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IModelLayoutCommon | host | The host of the current item that this is being opened from, and that the new layout should be added to |
| System.Object | itemSource | The item containing the id (on the |
| System.String | idBinding | The name of the property on the |
| EntityDescriptor | toOpenType | The type of item that should be opened with the id value from the |
| IEntityUpdaterUI | con | An optional context that the item should be opened within. If null the item may still be opened in the existing context if it has pending changes, otherwise a new context will be created for the opened layout |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation |