Bewerken

Delen via


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
[<System.Windows.Markup.ContentProperty("Action")>]
type PickBranch = class
Public NotInheritable Class PickBranch
Inheritance
PickBranch
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()

Creates a new instance of the PickBranch activity.

Properties

Action

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

DisplayName

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

Trigger

The activity whose completion activates this pick branch.

Variables

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

Methods

Equals(Object)

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

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to