Search Results for

    Show / Hide Table of Contents

    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
    object
    ServerTaskProgressDisplayer
    Implements
    IPollingTaskStatusDisplayer
    ITaskStatusDisplayer
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.Client.Core.Tasks
    Assembly: LemonEdge.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

    Guid taskID

    The ID of the task to track

    Properties

    CurrentStatus

    Returns the current status of the underlying task being tracked

    Declaration
    public ServerTaskStatusEnum CurrentStatus { get; }
    Property Value
    Type Description
    ServerTaskStatusEnum

    Header

    Returns the header of the task being tracked

    Declaration
    public string Header { get; }
    Property Value
    Type Description
    string

    MaxProgressIndex

    Indicates the maximum progress index used for reporting by the task so far

    Declaration
    public short MaxProgressIndex { get; }
    Property Value
    Type Description
    short

    Name

    Returns the name of the task being tracked

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    RunningOnServer

    True - this task is being executed remotely on the server

    Declaration
    public bool RunningOnServer { get; }
    Property Value
    Type Description
    bool

    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
    TimeSpan

    ServerTaskID

    Returns the unique ID of the IServerTask being tracked.

    Declaration
    public Guid? ServerTaskID { get; }
    Property Value
    Type Description
    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
    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
    string

    Methods

    Cancel()

    Cancel the task being tracked by setting Cancel to true

    Declaration
    public Task Cancel()
    Returns
    Type Description
    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
    Task<IEnumerable<ITaskMessage>>

    The history of all progress messages for all indexes for the specified message type

    GetAllProgressMesssages(short)

    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
    short progressIndex

    The index of the messages to report

    Returns
    Type Description
    Task<IEnumerable<ITaskMessage>>

    The history of all progress messages for the specified index for the task so far

    GetCurrentProgress(short)

    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
    short progressIndex

    The index of the progress to report

    Returns
    Type Description
    decimal

    The current progress of the specified index

    GetProgressCurrentMessage(short)

    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
    short progressIndex

    The index of the message to report

    Returns
    Type Description
    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
    Dictionary<Guid, List<Guid>> ignoreItemsToOpen

    A list of items to ignore if the handler is of type OpenOrRefreshResultItem

    Returns
    Type Description
    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
    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
    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
    EventHandler<EventArgs>

    Implements

    IPollingTaskStatusDisplayer
    ITaskStatusDisplayer

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.