Class TaskBase
The base task command for executing any IServerTask in the system, providing a popup of parameters to the user, running it locally or remotely, and tracking the progress of the task to notify the user
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Commands.ViewCommands
Assembly: LemonEdge.ClientCore.dll
Syntax
public abstract class TaskBase : ViewCommand, IHasChildren<EPCommandWithDescriptor>, IHasChildren, IDisposable, IEPCommandWithDescriptor, IEPCommand, ICommand, ICommandDescriptor
Constructors
TaskBase(bool, IRootController, IModelLayoutCommon, Guid)
Creates a new TaskBase command
Declaration
protected TaskBase(bool runOnServer, IRootController root, IModelLayoutCommon owner, Guid taskType)
Parameters
Type | Name | Description |
---|---|---|
bool | runOnServer | Indicates if the command should run on the server by default or not. If the task can be run locally then this behaviour can be overridden by the user when executing the command by holding down ctrl (indicated through IRootController.Viewer.IsKeyModifierPressed) |
IRootController | root | The root controller, for service access. |
IModelLayoutCommon | owner | The owner context this command is executed from within |
Guid | taskType | The globally unique id of the task type this command should execute |
Properties
Description
A user friendly description of this command
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
IconID
Declaration
public override Guid IconID { get; }
Property Value
Type | Description |
---|---|
Guid |
Overrides
IncludeInSimple
By default view commands are included in any simple layout filtering of commands if they are part of the quick access
Declaration
public override bool IncludeInSimple { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
InternalExecuteWithChanges
Indicates if the command can execute with changes against the context the command is in.
Default implementation returns true if this command runs locally, has a modifier key pressed to run locally, or has no pending changes against the context
Declaration
protected virtual bool InternalExecuteWithChanges { get; }
Property Value
Type | Description |
---|---|
bool |
IsQuickAccessCommand
Indicates this command should also be available in a quick access manner if the ui permits it to be highlighted and seperated for quick access among a group of other commands
For instance in the desktop application view commands are accessible from a drop down menu by default, but if this is true they are also directly accessible from the view itself
Declaration
public override bool IsQuickAccessCommand { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Key
Indicates the command key to use for executing this from a keyboard command
Declaration
public override KeyboardKey Key { get; }
Property Value
Type | Description |
---|---|
KeyboardKey |
Overrides
ModifierKeys
Indicates the modifier keys to be used with Key when executing this command from the keyboard
Declaration
public override KeyboardModifierKeys ModifierKeys { get; }
Property Value
Type | Description |
---|---|
KeyboardModifierKeys |
Overrides
RunOnServer
Declaration
public bool RunOnServer { get; }
Property Value
Type | Description |
---|---|
bool |
TaskParamType
The actual type of ServerTaskParameter class that holds the parameters for this server task implementation
Declaration
protected Type TaskParamType { get; }
Property Value
Type | Description |
---|---|
Type |
TaskType
The attribute describing the parameters for this task, which also holds the globally unique id of the task type
Declaration
protected ServerTaskParametersAttribute TaskType { get; }
Property Value
Type | Description |
---|---|
ServerTaskParametersAttribute |
Title
The title of this command
Declaration
public override string Title { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
ToolTip
A user friendly tool tip for this command functionality, by default the Description
Declaration
public override string ToolTip { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
GetParameters()
A function that returns the default parameters to use when creating this task
Used in conjunction with GetUserModifiedParametersFromDefault(IModelLayoutCommon, ServerTaskParameter) so hardcoded values can automatically be set, and the user can be prompted for any other required parameter selections if required
Declaration
protected abstract Task<ServerTaskParameter> GetParameters()
Returns
Type | Description |
---|---|
Task<ServerTaskParameter> | A task with the parameters, allowing optional popups to be shown to the user for parameter selection |
Remarks
For instance:
protected override Task<ServerTaskParameter> GetParameters()
{
var ps = new API.Tasks.Parameters.ResetAccountParameter();
ps.AccountID = accountID;
ps.AccountID_Label = accountName;
return GetUserModifiedParametersFromDefault(Owner, ps);
}
GetUserModifiedParametersFromDefault(IModelLayoutCommon, ServerTaskParameter)
Used to present a popup window to the user to edit the specified parameters for this task before executing it
Declaration
public static Task<ServerTaskParameter> GetUserModifiedParametersFromDefault(IModelLayoutCommon owner, ServerTaskParameter param)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | owner | The owning context for this task |
ServerTaskParameter | param | The parameter to be displayed and edited by the user |
Returns
Type | Description |
---|---|
Task<ServerTaskParameter> | The results of any edits made to the user on the |
InternalExecuteAsync(object)
Gets the parameters for the task (possibly prompting the user for som if GetParameters() override calls GetUserModifiedParametersFromDefault(IModelLayoutCommon, ServerTaskParameter)) and executes the task locally or against a task service depending on the setup
The system then also tracks the progress of the task in the application and notifies the user when the task is complete
Declaration
public override Task InternalExecuteAsync(object parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | The command parameter |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
InternalExecuteUserWarning()
Provides a mechanism for implementing commands to issue a warning to the user before executing. Can return false to abort the execution.
Declaration
protected virtual Task<bool> InternalExecuteUserWarning()
Returns
Type | Description |
---|---|
Task<bool> | True to continue executing the aommand (default) |
ProcessExecute(ServerTaskParameter, bool)
Performs the actual execution of creating and tracking the task.
Can be overriden if you have specific implementations, such as export data overrides this to export pure grid data if it does not need to get data from the service
Declaration
public virtual Task ProcessExecute(ServerTaskParameter taskParam, bool isKeymodifierPressed)
Parameters
Type | Name | Description |
---|---|---|
ServerTaskParameter | taskParam | The task parameter for executing the task |
bool | isKeymodifierPressed | If the key modifier is pressed to run the task locally |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
ProcessExecute(ServerTaskParameter, bool, ServerTaskOccurrence?, short?)
Declaration
public virtual Task ProcessExecute(ServerTaskParameter taskParam, bool isKeymodifierPressed, ServerTaskOccurrence? occurance = null, short? frequency = null)
Parameters
Type | Name | Description |
---|---|---|
ServerTaskParameter | taskParam | |
bool | isKeymodifierPressed | |
ServerTaskOccurrence? | occurance | |
short? | frequency |
Returns
Type | Description |
---|---|
Task |