PickBranch PickBranch PickBranch PickBranch Class

Definition

A potential path of execution within a Pick activity.

public ref class PickBranch sealed
[System.Windows.Markup.ContentProperty("Action")]
public sealed class PickBranch
type PickBranch = class
Public NotInheritable Class PickBranch
Inheritance
PickBranchPickBranchPickBranchPickBranch
Attributes

Examples

The following code sample demonstrates creating a PickBranch activity. This example is from the Using the Pick Activity sample.

static Activity CreateWF()
{
    Variable<string> name = new Variable<string>();
    Sequence body = new Sequence
    {
        Variables = { name },
        Activities = 
        {
            new WriteLine { Text = "What is your name? (You have 5 seconds to answer)" },
            new Pick
            {
               Branches = 
               {
                   new PickBranch
                    {
                       Trigger = new ReadString
                       {
                           Result = name,
                           BookmarkName = bookmarkName
                       },
                       Action = new WriteLine 
                       { 
                           Text = new InArgument<string>(env => "Hello " + name.Get(env)) 
                       }
                   },
                   new PickBranch
                    {
                       Trigger = new Delay
                       {
                           Duration = TimeSpan.FromSeconds(5)
                       },
                       Action = new WriteLine
                       {
                           Text = "Time is up."
                       }
                   }
               }
           }
       }
    };

    return body;
}

Remarks

A PickBranch contains a Trigger and an Action. At the beginning of a Pick element's execution, all the trigger activities from all PickBranch elements are scheduled. When the first (leftmost) activity completes, the corresponding action activity is scheduled, and all other trigger activities are canceled.

Constructors

PickBranch() PickBranch() PickBranch() PickBranch()

Creates a new instance of the PickBranch activity.

Properties

Action Action Action Action

The Activity to execute if this branch is triggered for execution.

DisplayName DisplayName DisplayName DisplayName

The name of this branch to be displayed in the activity designer.

Trigger Trigger Trigger Trigger

The activity whose completion activates this pick branch.

Variables Variables Variables Variables

The collection of user-defined variables associated with this activity.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to