Class ViewModelSharedInfo
Some shared info that can be used by any view model class in Aruba.
Inherited Members
Namespace: Phoenix.Aruba
Assembly: Phoenix.Plugin.Aruba.dll
Syntax
public class ViewModelSharedInfo
Remarks
Initializes a new instance of the ViewModelSharedInfo class. Constructor taking in all members.
Constructors
View SourceViewModelSharedInfo(IDataStoreProvider, IDataStoreProvider, IBugServiceClient, IEventAggregator, ILogger, Func<Exception, bool, string, Task>)
Some shared info that can be used by any view model class in Aruba.
Declaration
public ViewModelSharedInfo(IDataStoreProvider storeProvider, IDataStoreProvider userStoreProvider, IBugServiceClient bugServiceClient, IEventAggregator eventAggregator, ILogger logger, Func<Exception, bool, string, Task> exceptionHandler)
Parameters
Type | Name | Description |
---|---|---|
IDataStoreProvider | storeProvider | The store provider. |
IDataStoreProvider | userStoreProvider | The user store provider. |
IBugServiceClient | bugServiceClient | The bug service client. |
IEventAggregator | eventAggregator | The event aggregator. |
ILogger | logger | The logger. |
Func<Exception, bool, string, Task> | exceptionHandler | The exception handler. |
Remarks
Initializes a new instance of the ViewModelSharedInfo class. Constructor taking in all members.
Properties
View SourceBugServiceClient
Gets the instance of IBugServiceClient to use.
Declaration
public IBugServiceClient BugServiceClient { get; }
Property Value
Type | Description |
---|---|
IBugServiceClient |
EventAggregator
Gets the Prism.Events.IEventAggregator to use to publish and subscribe to view-related events.
Declaration
public IEventAggregator EventAggregator { get; }
Property Value
Type | Description |
---|---|
IEventAggregator |
ExceptionHandler
Gets a handler for exceptions, returning a Task so that it can present a dialog if needed, etc. The bool parameter indicates whether the exception is assumed to be due to user (input-based) error. The string parameter is a "context" for the exception, that can be presented to the user as part of a message, like "creating bug", "saving file", etc.
Declaration
public Func<Exception, bool, string, Task> ExceptionHandler { get; }
Property Value
Type | Description |
---|---|
Func<Exception, bool, string, Task> |
Logger
Gets the ILogger to use for logging from operations.
Declaration
public ILogger Logger { get; }
Property Value
Type | Description |
---|---|
ILogger |
StoreProvider
Gets the IDataStoreProvider used to read and save data.
Declaration
public IDataStoreProvider StoreProvider { get; }
Property Value
Type | Description |
---|---|
IDataStoreProvider |
UserStoreProvider
Gets the IDataStoreProvider used to read and save user-specific data.
Declaration
public IDataStoreProvider UserStoreProvider { get; }
Property Value
Type | Description |
---|---|
IDataStoreProvider |
Methods
View SourceTryExecuteBusyAsync(Func<Task>, bool, string, Dispatcher)
Wrap the running of a task inside a request to show the UI as "busy" during that task.
Declaration
public Task<bool> TryExecuteBusyAsync(Func<Task> operation, bool isCritical, string context, Dispatcher dispatcher)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | operation | The function to run. |
bool | isCritical | Indicates whether it is a critical task. |
string | context | The context to provide to the user about the exception. |
Dispatcher | dispatcher | The dispatcher. |
Returns
Type | Description |
---|---|
Task<bool> | The Task with the result of the execution. |
TryOperationWithExceptionHandlerAsync(Func<Task>, bool, string)
Utility to help wrap an async operation inside our exception handler.
Declaration
public Task<bool> TryOperationWithExceptionHandlerAsync(Func<Task> operation, bool isCritical, string context)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | operation | The function to run. |
bool | isCritical | Indicates whether it is a critical task. |
string | context | The context to provide to the user about the exception. |
Returns
Type | Description |
---|---|
Task<bool> | The Task with the result of the execution. |