Class Delay
- Namespace
- Acuit.Pinpoint.Workflows.Activities
- Assembly
- Acuit.Pinpoint.Workflows.dll
An activity that delays for a specified duration.
public class Delay : Activity, IActivity
- Inheritance
-
Delay
- Implements
- Inherited Members
Remarks
This activity requires a ITimeService service (automatically provided by Acuit Pinpoint Workstation).
Properties
Duration
Gets or sets the duration for which to delay. This is required and must be greater than or equal to zero.
public ValueSource<TimeSpan> Duration { get; set; }
Property Value
TimeLeftVariableName
Gets or sets an optional variable name into which to set the time left in the delay, updating every UpdateInterval. When set, the variable will be set to a value of type TimeSpan.
public ValueSource<string> TimeLeftVariableName { get; set; }
Property Value
Remarks
This variable is prioritized for display, not accurate time-keeping. For example, for a Duration of three seconds and an UpdateInterval of one second, this variable will be set exactly four times: first to 00:00:03, then to 00:00:02, then to 00:00:01, and finally to 00:00:00. These updates should happen approximately at the correct times, but they can be delayed due to asynchronous code scheduling.
Update
Gets or sets an optional activity that will be executed upon each update every UpdateInterval. When set, this will be executed as the activity starts, upon each UpdateInterval period, and when the delay completes if it completes between UpdateInterval periods. This will be executed after the variable specified by TimeLeftVariableName is updated.
public IActivity Update { get; set; }
Property Value
UpdateInterval
Gets or sets the interval for updating the variable specified by TimeLeftVariableName and executing Update. This must be greater than zero. The default value is one second.
public ValueSource<TimeSpan> UpdateInterval { get; set; }
Property Value
Methods
OnExecuteAsync(ActivityContext, CancellationToken)
Derived classes must implement this to perform the activity.
protected override Task OnExecuteAsync(ActivityContext context, CancellationToken cancellationToken)
Parameters
context
ActivityContextThe activity context.
cancellationToken
CancellationTokenThe cancellation token used to request canceling the activity.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ArgumentNullException
context
is null.- InvalidOperationException
A service required by the activity is not available, or a required activity property value is not set.
- Exception
An error occurred while performing the activity.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Remarks
This is expected to produce a string suitable for labeling this activity in a workflow diagram. It should be as specific as possible, but while keeping it very short. In general, it should be the short name of the class (as that is how it would typically be defined in the workflow XAML), optionally followed by other property values of interest in a diagram. The default implementation returns the short name of the class.