Handles the execution of a parallel activities, sequence or workflow by anticipating the exceptions or cancellations within them
Display Name - Renames the activity.
- Create a new workflow and save it as NewCancellationWorkflow.xml.
- Add a Parallel activity inside the Sequence.
- On the CompletionCondition Misc Property of the Parallel activity, enter true.
- Inside the Parallel activity, drag and drop a Cancellation Scope activity.
- Add a Sequence inside the Body of the Cancellation Scope.
- Add a Delay activity on the newly added Sequence inside the Cancellation Scope's Body.
- Create a Variable with the name PlayerOneRunTime of type System.TimeSpan and assign it the default value TimeSpan.FromSeconds(8).
- Enter the PlayerOneRunTime variable in the Duration Misc Property of the Delay activity.
- Add a Write Line activity after the Delay and enter "Player One Finished" on its Text field.
- Add another Write Line activity inside the CancellationHandler and enter "Player 1 Stops" on its Text Field.
- Copy the Cancellation Scope activity and Paste it beside the original Cancellation Scope just inside the Parallel activity.
- Change the values in the Text fields of Write Line activities inside the new Cancellation Scope "Player Two Finished" and "Player 2 Stops" accordingly.
- Create another Variable with the name PlayerTwoRunTime of type System.TimeSpan and assign it the default value TimeSpan.FromSeconds(5).
- 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: