Class RootController
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(IRootModelViewer, bool) with an IRootModelViewer 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 platformsImplements
Inherited Members
Namespace: LemonEdge.Client.Core
Assembly: LemonEdge.ClientCore.dll
Syntax
public class RootController : IRootController
Constructors
RootController(IRootModelViewer, IServiceContext, IUIContext, ICacheManager, ISerializedParamConverter, IAutoUpdaterChecker, ILogger<RootController>)
Declaration
public RootController(IRootModelViewer viewer, IServiceContext serviceContext, IUIContext uiContext, ICacheManager cacheManager, ISerializedParamConverter paramConverter, IAutoUpdaterChecker autoUpdaterChecker, ILogger<RootController> logger)
Parameters
Type | Name | Description |
---|---|---|
IRootModelViewer | viewer | |
IServiceContext | serviceContext | |
IUIContext | uiContext | |
ICacheManager | cacheManager | |
ISerializedParamConverter | paramConverter | |
IAutoUpdaterChecker | autoUpdaterChecker | |
ILogger<RootController> | logger |
Properties
AutoUpdaterChecker
TODO: REMOVE- this is called in every command execute. Feels like this is wrong? should really be called somewhere else Returns the session IAutoUpdaterChecker.
Declaration
public IAutoUpdaterChecker AutoUpdaterChecker { get; }
Property Value
Type | Description |
---|---|
IAutoUpdaterChecker |
CacheManager
TODO: REMOVE? Returns the session ICacheManager.
Declaration
public ICacheManager CacheManager { get; }
Property Value
Type | Description |
---|---|
ICacheManager |
ParamConverter
Declaration
public ISerializedParamConverter ParamConverter { get; init; }
Property Value
Type | Description |
---|---|
ISerializedParamConverter |
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
public bool PauseWaiterActions { get; set; }
Property Value
Type | Description |
---|---|
bool |
ServiceContext
The service / core context.
Declaration
public IServiceContext ServiceContext { get; }
Property Value
Type | Description |
---|---|
IServiceContext |
UIContext
The context for UI tooling.
Declaration
public IUIContext UIContext { get; }
Property Value
Type | Description |
---|---|
IUIContext |
Viewer
The ModelViewer this ModelController is using that is implemented by the client application to provide the specific UI components required by LemonEdge
Declaration
public IRootModelViewer Viewer { get; }
Property Value
Type | Description |
---|---|
IRootModelViewer |
Methods
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
public 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 |
CreateWindow<T>(IWindow?, bool)
Creates the specified type of window in the client application ui that implements the specified interface
Declaration
public T CreateWindow<T>(IWindow? owner, bool show = false) where T : IWindow
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | An optional parent window for the created window |
bool | show | Whether to show |
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 |
CreateWindow<TWindow, TController>(IWindow?, bool)
Creates the specified window with controller in the client application ui
Declaration
public WindowAndController<TWindow, TController> CreateWindow<TWindow, TController>(IWindow? owner = null, bool show = false) where TWindow : IWindow where TController : class
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | |
bool | show |
Returns
Type | Description |
---|---|
WindowAndController<TWindow, TController> |
Type Parameters
Name | Description |
---|---|
TWindow | |
TController |
DisplayAnyParamSingle(IModelLayoutCommon, SerializedParam)
Declaration
public 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
public 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
public 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<T>(IModelLayoutCommon, T)
Declaration
public Task<(bool WindowExistsInUI, bool OkClicked, T Result)> DisplayParamSingle<T>(IModelLayoutCommon host, T param) where T : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | |
T | param |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, T Result)> |
Type Parameters
Name | Description |
---|---|
T |
DisplayParam<T>(IModelLayoutCommon, T)
Declaration
public Task<(bool WindowExistsInUI, bool OkClicked, T Result)> DisplayParam<T>(IModelLayoutCommon host, T param) where T : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | |
T | param |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, T Result)> |
Type Parameters
Name | Description |
---|---|
T |
DisplayPopup<T, TResult>(IWindow, Func<T, Task>, Func<T, IPopupWindowController<TResult>>)
Declaration
public Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> DisplayPopup<T, TResult>(IWindow owner, Func<T, Task> initWindow, Func<T, IPopupWindowController<TResult>> createController) where T : IPopupWindow<TResult>
Parameters
Type | Name | Description |
---|---|---|
IWindow | owner | |
Func<T, Task> | initWindow | |
Func<T, IPopupWindowController<TResult>> | createController |
Returns
Type | Description |
---|---|
Task<(bool WindowExistsInUI, bool OkClicked, TResult Result)> |
Type Parameters
Name | Description |
---|---|
T | |
TResult |
OnUnhandledException(object, UnhandledExceptionEventArgs)
The handler for an unhandled exception.
Declaration
public void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | |
UnhandledExceptionEventArgs | e |
ProcessException(Exception)
A handler for exception processing.
Declaration
public Task ProcessException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception |
Returns
Type | Description |
---|---|
Task |
Reload()
Reloads the application's discoverable UI components.
Declaration
public Task Reload()
Returns
Type | Description |
---|---|
Task |
Shutdown()
Forces a shutdown of the entire client application
Declaration
public void Shutdown()