Share via


PickBranch Costruttore

Definizione

Crea una nuova istanza dell'attività PickBranch.

public:
 PickBranch();
public PickBranch ();
Public Sub New ()

Esempio

Nell'esempio di codice riportato di seguito viene illustrata la creazione di un'attività PickBranch. Questo esempio proviene dall'esempio Using the Pick 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;
}

Si applica a