Table of Contents

Class SampleWhenAny

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

Samples a value from multiple activities that produce data values running in parallel, waiting for the first one to produce a value. When a data value is received, all other activities still running will be canceled.

public class SampleWhenAny : Activity<IDataValue>, IActivity
Inheritance
SampleWhenAny
Implements
Inherited Members

Examples

<TakeValue Name="Ignition Gas Flow">
  <SampleWhenAny Timeout="0:00:50">
    <SampleValidOverSlidingWindow DataSource="{Reading GasFlowRate}" WindowDuration="0:00:11">
      <SampleValidOverTime.Validator>
        <GreaterThanOrEqualToValidator Value="2" />
      </SampleValidOverTime.Validator>
    </SampleValidOverSlidingWindow>
    <SampleWhenBecomesValid DataSource="{Reading GasFlowRate}">
      <SampleWhenBecomesValid.Validator>
        <GreaterThanOrEqualToValidator Value="12" />
      </SampleWhenBecomesValid.Validator>
    </SampleWhenBecomesValid>
  </SampleWhenAny>
</TakeValue>

Remarks

The activity result value will be the resulting value.

Properties

Activities

Gets the collection of activities that produce data values from which to wait for the first sample.

public Collection<Activity<IDataValue>> Activities { get; }

Property Value

Collection<Activity<IDataValue>>

Timeout

Gets or sets an optional timeout duration. When set, it must be greater than Zero.

public ValueSource<TimeSpan?> Timeout { get; set; }

Property Value

ValueSource<TimeSpan?>

Methods

OnExecuteAsync(ActivityContext, CancellationToken)

Derived classes must implement this to perform the activity.

protected override Task<IDataValue> OnExecuteAsync(ActivityContext context, CancellationToken cancellationToken)

Parameters

context ActivityContext

The activity context.

cancellationToken CancellationToken

The cancellation token used to request canceling the activity.

Returns

Task<IDataValue>

A task that represents the asynchronous operation. The value of its Result property contains the result.

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.