Table of Contents

Class Stopwatch

Namespace
Acuit.Pinpoint.Workflows.Activities
Assembly
Acuit.Pinpoint.Workflows.dll

An activity that measures elapsed time.

public class Stopwatch : Activity, IActivity
Inheritance
Stopwatch
Implements
Inherited Members

Remarks

If this activity is canceled, the ElapsedVariableName variable will not be updated to reflect the time up to the cancellation. The value will only reflect the correct execution time when the activity runs to completion with no error or up to the point that an exception occurs.

This activity requires a ITimeService service (automatically provided by Acuit Pinpoint Workstation).

Properties

Body

Gets or sets the optional child activity to execute. Typically, this is the activity that is to be timed.

public IActivity Body { get; set; }

Property Value

IActivity

ElapsedVariableName

Gets or sets the variable name into which to set the elapsed time, updating every UpdateInterval. This is required. The variable will be set to a value of type TimeSpan.

public ValueSource<string> ElapsedVariableName { get; set; }

Property Value

ValueSource<string>

UpdateInterval

Gets or sets the interval for updating the variable specified by ElapsedVariableName. This must be greater than or equal to zero. The default value is zero. If the value is zero, the ElapsedVariableName variable will only be set at the beginning, to zero, and when the activity completes with the elapsed time. If the value is greater than zero, the ElapsedVariableName variable will also be updated according to that interval while the activity executes.

public ValueSource<TimeSpan> UpdateInterval { get; set; }

Property Value

ValueSource<TimeSpan>

Methods

OnExecuteAsync(ActivityContext, CancellationToken)

Derived classes must implement this to perform the activity.

protected override Task OnExecuteAsync(ActivityContext context, CancellationToken cancellationToken)

Parameters

context ActivityContext

The activity context.

cancellationToken CancellationToken

The 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. This will only occur asynchronously, wrapped in an AggregateException as the faulted task's Exception.

Exception

An error occurred while performing the activity. This will only occur asynchronously, wrapped in an AggregateException as the faulted task's Exception.

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.