Table of Contents

Class SampleWhenBecomesValid

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

Samples data values, taking the first one that becomes valid.

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

Examples

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

Remarks

The activity result value will be the resulting data value, which will either be the first one that was valid, or the last invalid sample taken after Timeout expires.

Properties

DataSource

Gets or sets the data source to sample.

public ValueSource<IDataSource> DataSource { get; set; }

Property Value

ValueSource<IDataSource>

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?>

Validator

Gets or sets the validator used to validate the data value. This is required. The validator is initialized once as the activity starts--i.e., arguments are not continuously evaluated while waiting.

public IDataValueValidator Validator { get; set; }

Property Value

IDataValueValidator

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. 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.