System.Activities.Statements.Pick & System.Activities.Statements.PickBranch
- Pick activity simplifies the modeling of a set of event triggers followed by their corresponding handlers.
- A Pick activity contains a collection of PickBranch activities, where each PickBranch is a pairing between a Trigger activity and an Action activity.
- At the execution time, the triggers for all branches are executed in parallel.
When one trigger completes, then its corresponding action is executed, and all other triggers are canceled.
Properties
Misc
- DisplayName (String) – To set a meaningful name according to the user.
Example
To use Pick & PickBranch activities, create an automation that asks user for a name, if user enters the name before the delay time then displays a message with the name in the Output panel otherwise displays a Time’s up message.
- Create a sequence.
- Create a string variable, Name.
- Add a Pick
- Inside the Pick activity, add two PickBranch
- In the Trigger section of first PickBranch, add an Input Dialog
- In the Properties panel of Input Dialog activity, type label and title to prompt user for a number and, in the Result field, add the Name
- In the Action section, type “Hello” + Name in the Text
- In the Trigger section of second PickBranch, add a Delay
- In the Properties panel of Delay activity, type 00:00:10 in the Duration
- In the Action section, type “Time’s Up” in the Text
- Run the process and see the message displays according to the user’s input in the Output panel after the execution.