WorkflowActivityBase

Package: MyToolkit (PCL)
Platforms: All (PCL)

Subclasses:
A workflow activity describes one state of a workflow definition. Important: An activity must not contain instance state, the properties of activities are parameters which belong to the definition and which parameterize all instances.

Usage

The idea of the WorkflowActivityBase class is to inherit from it and override the PrepareAsync or CompleteAsync methods:

[XmlType("MockActivity")]
public class MockActivity : WorkflowActivityBase
{
    public override Task<WorkflowActivityResult> CompleteAsync(WorkflowInstance instance,
        WorkflowDefinition definition, WorkflowActivityArguments args, 
        CancellationToken cancellationToken)
    {
        // TODO: Add your logic here
        return Task.FromResult(new WorkflowActivityResult(true));
    }
}

The CompleteAsync method has to return a WorkflowActivityResult object which contains the description of the next activities, a value indicating whether the execution was successful and a custom result value.

TODO: Describe PrepareAsync method

Last edited Jul 30, 2014 at 5:13 PM by rsuter, version 3