Description

    Handles the execution of a parallel activities, sequence or workflow by anticipating the exceptions or cancellations within them


Attributes

    Misc

  • Display Name - Renames the activity.


Example

  1. Create a new workflow and save it as NewCancellationWorkflow.xml.
  2. Add a Parallel activity inside the Sequence.
  3. On the CompletionCondition Misc Property of the Parallel activity, enter true.
  4. Inside the Parallel activity, drag and drop a Cancellation Scope activity.
  5. Add a Sequence inside the Body of the Cancellation Scope.
  6. Add a Delay activity on the newly added Sequence inside the Cancellation Scope's Body.
  7. Create a Variable with the name PlayerOneRunTime of type System.TimeSpan and assign it the default value TimeSpan.FromSeconds(8).
  8. Enter the PlayerOneRunTime variable in the Duration Misc Property of the Delay activity.
  9. Add a Write Line activity after the Delay and enter "Player One Finished" on its Text field.
  10. Add another Write Line activity inside the CancellationHandler and enter "Player 1 Stops" on its Text Field.
  11. Copy the Cancellation Scope activity and Paste it beside the original Cancellation Scope just inside the Parallel activity.
  12. Change the values in the Text fields of Write Line activities inside the new Cancellation Scope "Player Two Finished" and "Player 2 Stops" accordingly.
  13. Create another Variable with the name PlayerTwoRunTime of type System.TimeSpan and assign it the default value TimeSpan.FromSeconds(5).
  14. Enter the PlayerTwoRunTime variable in the Duration Misc Property of the Delay activity.


            The use case should look like the following screenshot:


The output should look like this in the Output panel: