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: ClientCore.dll
Syntax
public abstract class TaskBase : ViewCommand, IHasChildren<EPCommandWithDescriptor>, IHasChildren, IDisposable, IEPCommandWithDescriptor, IEPCommand, ICommand, ICommandDescriptor
Constructors
TaskBase(Boolean, IModelLayoutCommon, Guid)
Creates a new TaskBase command
Declaration
public TaskBase(bool runOnServer, IModelLayoutCommon owner, Guid taskType)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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 |
IModelLayoutCommon | owner | The owner context this command is executed from within |
System.Guid | taskType | The globally unique id of the task type this command should execute |
Properties
Description
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
IconID
Declaration
public override Guid IconID { get; }
Property Value
Type | Description |
---|---|
System.Guid |
Overrides
IncludeInSimple
Declaration
public override bool IncludeInSimple { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
Key
Declaration
public override KeyboardKey Key { get; }
Property Value
Type | Description |
---|---|
KeyboardKey |
Overrides
ModifierKeys
Declaration
public override KeyboardModifierKeys ModifierKeys { get; }
Property Value
Type | Description |
---|---|
KeyboardModifierKeys |
Overrides
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 |
---|---|
System.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
Declaration
public override string Title { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
ToolTip
Declaration
public override string ToolTip { get; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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 |
---|---|---|
System.Object | parameter | The command parameter |
Returns
Type | Description |
---|---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True to continue executing the aommand (default) |
ProcessExecute(ServerTaskParameter, Boolean)
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 |
System.Boolean | isKeymodifierPressed | If the key modifier is pressed to run the task locally |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |