Using the Parallel activity
In this task, we will create a sample that will use the Parallel activity. The Parallel activity can execute its child activities in parallel, asynchronously.
How to do it...
Create a workflow project:
Create a new Workflow Console Application under solution
Chapter02
and name the project asUsingParallelActivity
.Create a workflow:
Open
Workflow1.xaml
and create a workflow as shown in the following screenshot:Set the properties of both Delay activities:
Run it:
Set
UsingParallelActivity
as StartUp project. Press CTRL+F5 to build and run the workflow without debugging.
How it works...
Workflow execution starts from Sequence1, then there is a delay of 5 seconds and the execution of Parallel will shift to the Sequence2 branch immediately. Now Sequence2 will delay for 5 seconds and the execution shift to the Sequence1 branch again, and now, both Sequence1 and Sequence2 are in a delaying state. The whole Parallel activity will wait there until one of them awakes....