Interface IModelController
The model controller is the client application controller used by all LemonEdge clients. This is responsible for creating the main application along with new windows, popups, messages, etc.
If you are creating your own application you can utilise the LemonEdge controllers by calling Create(IModelViewer, bool) with an IModelViewer implementation.
This is required as LemonEdge has multiple different clients running on windows, console, and web versions, they all implement the ui interfaces and connect through this model controller so lemonedge can just work with different ui platformsNamespace: LemonEdge.Client.Core
Assembly: LemonEdge.ClientCore.dll
Syntax
public interface IModelController
Properties
PauseWaiterActions
Only used by single thread application models, such as a command console
Indicates that while the system is processing a task it should update the ui with a periodic indicator that it is processing.
When this is false (default) it will not update the ui. For instance for the console application it will add a [.] every second it is still processing when this is true, and not for any other tasksDeclaration
bool PauseWaiterActions { get; set; }
Property Value
Type | Description |
---|---|
bool |
Viewer
The ModelViewer this ModelController is using that is implemented by the client application to provide the specific UI components required by LemonEdge
Declaration
IModelViewer Viewer { get; }
Property Value
Type | Description |
---|---|
IModelViewer |
Methods
CreateLogin(IWindow)
Creates the main login view and sets it up for lgging into the LemonEdge platform
Declaration
ILoginWindow CreateLogin(IWindow owner = null)
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | An optional owning window. When starting the application this is null, when switching login this will be the current main window |
Returns
Type | Description |
---|---|
ILoginWindow | The created login window in the client application ui |
CreateMainForm(ISplashScreen, bool)
Creates the main form application from the client ui, then checks the version of the application and service match, along with the license being valid, and then loads the local cache all while updating the splash screen to show the progress
Declaration
Task<IMainForm> CreateMainForm(ISplashScreen splashScreen, bool forceCacheLoadFromServer)
Parameters
Type | Name | Description |
---|---|---|
ISplashScreen | splashScreen | The current splashscreen being showed while the main application loads |
bool | forceCacheLoadFromServer | If false indicates the local cache should be loaded, if one doesn't exist or this is false then it will always load the cache from the system and ignore any local copy |
Returns
Type | Description |
---|---|
Task<IMainForm> | The mainform created in the client application when the startup and cache have finished loading |
CreateSplashScreen()
Creates the splash screen to be shown while initially loading the main application after logging in successfully
Declaration
ISplashScreen CreateSplashScreen()
Returns
Type | Description |
---|---|
ISplashScreen | The created splash screen in the client application ui |
CreateWindow<T>(IWindow)
Creates the specified type of window in the client application ui that implements the specified interface
Declaration
T CreateWindow<T>(IWindow owner) where T : IWindow
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | An optional parent window for the created window |
Returns
Type | Description |
---|---|
T | The created window in the client application ui |
Type Parameters
Name | Description |
---|---|
T | The interface the window to be created by the client application must implement |
DisplayAnyParamSingle(IModelLayoutCommon, SerializedParam)
Declaration
Task<(bool WindowExistsInUI, bool OkClicked, SerializedParam Result)> DisplayAnyParamSingle(IModelLayoutCommon host, SerializedParam param)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | |
SerializedParam | param |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, SerializedParam Result)> |
DisplayMessage(IWindow, MessageType, Exception)
Displays the specified exception message to the user in the client application ui
Declaration
Task<MessageResult> DisplayMessage(IWindow owner, MessageType type, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | The owning window that originates the message, ensuring this message is a child of it |
MessageType | type | The type of message to display |
Exception | ex | The exception to display the details of to the user |
Returns
Type | Description |
---|---|
Task<MessageResult> | A task returning how the user dismissed the message box |
DisplayMessage(IWindow, MessageType, string, string, ImageType)
Displays the specified message to the user in the client application ui
Declaration
Task<MessageResult> DisplayMessage(IWindow owner, MessageType type, string title, string message, ImageType img)
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | The owning window that originates this message |
MessageType | type | The type of message to display |
string | title | The title for the message |
string | message | The message itself to display to the user |
ImageType | img | The image to use with the message |
Returns
Type | Description |
---|---|
Task<MessageResult> | A task returning how the user dismissed the message box |
DisplayParamSingle<TResult>(IModelLayoutCommon, TResult)
Declaration
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> DisplayParamSingle<TResult>(IModelLayoutCommon host, TResult param) where TResult : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | |
TResult | param |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> |
Type Parameters
Name | Description |
---|---|
TResult |
DisplayParam<TResult>(IModelLayoutCommon, TResult)
Declaration
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> DisplayParam<TResult>(IModelLayoutCommon host, TResult param) where TResult : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | |
TResult | param |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> |
Type Parameters
Name | Description |
---|---|
TResult |
DisplayPopup<T, TResult>(IWindow, Func<T, Task>, Func<T, PopupWindowController<TResult>>)
Declaration
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> DisplayPopup<T, TResult>(IWindow owner, Func<T, Task> initWindow, Func<T, PopupWindowController<TResult>> createController) where T : IPopupWindow<TResult>
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | |
Func<T, Task> | initWindow | |
Func<T, PopupWindowController<TResult>> | createController |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> |
Type Parameters
Name | Description |
---|---|
T | |
TResult |
OnUnhandledException(object, UnhandledExceptionEventArgs)
Declaration
void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | |
UnhandledExceptionEventArgs | e |
ProcessException(Exception)
Declaration
Task ProcessException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception |
Returns
Type | Description |
---|---|
Task |
Shutdown()
Forces a shutdown of the entire client application
Declaration
void Shutdown()