The Pick activity in WF4 is similar to the Listen activity in WF3. This activity will execute one of its parallel subactivities, and only one of its activities will be executed before the Pick activity completes. Typically, we use Pick to set up a time-out for an activity.
Create a new Workflow Console Application and name it
UsingPickActivity
.Create a workflow as shown in the following screenshot:
Set the Properties of the Delay activity of Branch1:
Set the Properties of the Delay activity of Branch2:
Open the
Program.cs
file and fill the file with following code:using System; using System.Activities; using System.Activities.Statements; using System.Threading; namespace UsingPickActivity { class Program { static void Main(string[] args) { AutoResetEvent waitHandler = new...