Table of Contents

Class ExecuteWorkflow

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

Executes another workflow.

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

Examples

To execute another workflow that is in a XAML file located in the same location as the current workflow's XAML file:

<ExecuteWorkflow Source="AnotherWorkflow.xaml" />

The following AddWorkflow.xaml child workflow demonstrates input parameters and output values via variables:

<Sequence xmlns="http://schemas.acuit.com/pinpoint/2020/xaml/workflows">
    <Sequence.Parameters>
        <Parameter Name="Value1" Type="int" />
        <Parameter Name="Value2" Type="int" />
        <Parameter Name="OutputVariableName" Type="string" />
    </Sequence.Parameters>
    <SetVariable Name="[param.OutputVariableName]" Value="[param.Value1 + param.Value2]" />
</Sequence>

This is how the above workflow could be used:

<Sequence>
    <Sequence.Variables>
        <Variable Name="Result" Type="int" />
    </Sequence.Variables>
    <ExecuteWorkflow Source="AddWorkflow.xaml">
        <ExecuteWorkflow.ParameterValues>
            <ParameterValue Name="Value1" Value="81" />
            <ParameterValue Name="Value2" Value="42" />
            <ParameterValue Name="OutputVariableName" Value="Result" />
        </ExecuteWorkflow.ParameterValues>
    </ExecuteWorkflow>
</Sequence>

Remarks

Workflows executed via ExecuteWorkflow inherit the context from the ExecuteWorkflow activity, including parameters, variables, and services, just as if the child workflow XAML were actually placed within the parent workflow.

Input values to child workflows should be specified via parameters defined in the child workflow. Specific values for those parameters can be specified in the ExecuteWorkflow activity via ParameterValues.

Output values from child workflows can be returned via variables.

Properties

ParameterValues

Gets the list of additional parameter values to make available to the executed workflow.

public Collection<ParameterValue> ParameterValues { get; }

Property Value

Collection<ParameterValue>

Remarks

For each item in this list, both the Name and Value properties will be evaluated right before each time the workflow is executed.

Source

Gets or sets the WorkflowSource for the workflow to execute.

public WorkflowSource Source { get; set; }

Property Value

WorkflowSource

Remarks

WorkflowSource will automatically convert from a string or Uri representing the URI to the source XAML, or from a Stream that produces XAML.

In XAML, this can be specified as a relative file name (relative to the XAML file or resource containing the ExecuteWorkflow activity), or as an absolute file name or a pack URI specifying a resource. Pack URIs specifying resources are supported as long as they are in an absolute form like: pack://application:,,,/YourAssemblyShortName;component/Subfolder/ResourceFile.xaml

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.