Class ServerTaskProgressDisplayer
An implementation of ITaskStatusDisplayer used for monitoring remotely executing tasks, and polling their status in order to display them in the client application.
Inheritance
Inherited Members
Namespace: LemonEdge.Client.Core.Tasks
Assembly: ClientCore.dll
Syntax
public class ServerTaskProgressDisplayer : IPollingTaskStatusDisplayer, ITaskStatusDisplayer
Constructors
ServerTaskProgressDisplayer(IModelLayoutCommon, IServerTask)
Creates a server task displayer for tracking the specified task
Declaration
public ServerTaskProgressDisplayer(IModelLayoutCommon host, IServerTask task)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | The host context this should be tracked in |
IServerTask | task | The task to track |
ServerTaskProgressDisplayer(IModelLayoutCommon, Guid)
Creates a server task displayer for tracking the specified task
Declaration
public ServerTaskProgressDisplayer(IModelLayoutCommon host, Guid taskID)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | The host context this should be tracked in |
System.Guid | taskID | The ID of the task to track |
Properties
CurrentStatus
Returns the current status of the underlying task being tracked
Declaration
public ServerTaskStatus CurrentStatus { get; }
Property Value
Type | Description |
---|---|
ServerTaskStatus |
Header
Returns the header of the task being tracked
Declaration
public string Header { get; }
Property Value
Type | Description |
---|---|
System.String |
MaxProgressIndex
Indicates the maximum progress index used for reporting by the task so far
Declaration
public short MaxProgressIndex { get; }
Property Value
Type | Description |
---|---|
System.Int16 |
Name
Returns the name of the task being tracked
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
RunningOnServer
True - this task is being executed remotely on the server
Declaration
public bool RunningOnServer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ServerPollingInterval
THe interval for the client to poll the status of the remotely executing task. Default is every 2 seconds.
Declaration
public static TimeSpan ServerPollingInterval { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
ServerTaskID
Returns the unique ID of the IServerTask being tracked.
Declaration
public Guid? ServerTaskID { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Guid> |
TimeRunning
A user friendly message of how long the task took to run, or how long it has currenty been running for
Declaration
public string TimeRunning { get; }
Property Value
Type | Description |
---|---|
System.String |
Tooltip
A user friendly tooltip for the currently tracked task containing header info, status and the percentage progress
Declaration
public string Tooltip { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Cancel()
Cancel the task being tracked by setting Cancel to true
Declaration
public Task Cancel()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the message. This only indicates the task is being set to cancel, the task itself still needs to respond to the request |
GetAllMessages(TaskMessageType)
Returns the history of all progress messages for all indexes for the specified message type
Declaration
public Task<IEnumerable<ITaskMessage>> GetAllMessages(TaskMessageType type)
Parameters
Type | Name | Description |
---|---|---|
TaskMessageType | type | The type of reported messages to return |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ITaskMessage>> | The history of all progress messages for all indexes for the specified message type |
GetAllProgressMesssages(Int16)
Returns the history of all progress messages for the specified index for the task so far
Declaration
public Task<IEnumerable<ITaskMessage>> GetAllProgressMesssages(short progressIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | progressIndex | The index of the messages to report |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ITaskMessage>> | The history of all progress messages for the specified index for the task so far |
GetCurrentProgress(Int16)
Returns the current progress for the specified index. The default, or main progress, is reported with an index of 0.
See IProgressReporter for more information
Declaration
public decimal GetCurrentProgress(short progressIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | progressIndex | The index of the progress to report |
Returns
Type | Description |
---|---|
System.Decimal | The current progress of the specified index |
GetProgressCurrentMessage(Int16)
Returns the current message/status associated with the current progress for the specified index. The default, or main progress, is reported with an index of 0.
See IProgressReporter for more information
Declaration
public string GetProgressCurrentMessage(short progressIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | progressIndex | The index of the message to report |
Returns
Type | Description |
---|---|
System.String | The current message/staus for the associated progress of the specified index |
HandleTask(IModelLayoutCommon, IServerTask, IServerTaskData, Dictionary<Guid, List<Guid>>)
Given a completed task, this method will execute the client handler for the task if one exists to display the result to the user
Declaration
public static Task HandleTask(IModelLayoutCommon host, IServerTask task, IServerTaskData data, Dictionary<Guid, List<Guid>> ignoreItemsToOpen = null)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | The host this task result should be handled in |
IServerTask | task | The completed task to handle the result of |
IServerTaskData | data | |
System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> | ignoreItemsToOpen | A list of items to ignore if the handler is of type OpenOrRefreshResultItem |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RunMonitoring(Action)
Indicates the tracker should start monitoring the status of the remotely executing task
Declaration
public Task RunMonitoring(Action onTaskEnded)
Parameters
Type | Name | Description |
---|---|---|
System.Action | onTaskEnded | Called whenever the tracker detects the task has stopped executing for one reason or another. Stops the monitoring as well. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
StopMonitoring()
Indicates the tracker should stop monitoring the status of the remotely executing task
Declaration
public void StopMonitoring()
Events
OnStatusChanged
Indicates the status of the task being tracked has changed, so the UI has chance to reflect this
Declaration
public event EventHandler<EventArgs> OnStatusChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |