共用方式為


PickBranch.Trigger 屬性

定義

完成時會啟動此選取分支的活動。

public:
 property System::Activities::Activity ^ Trigger { System::Activities::Activity ^ get(); void set(System::Activities::Activity ^ value); };
[System.Windows.Markup.DependsOn("Variables")]
public System.Activities.Activity Trigger { get; set; }
[<System.Windows.Markup.DependsOn("Variables")>]
member this.Trigger : System.Activities.Activity with get, set
Public Property Trigger As Activity

屬性值

觸發活動。

屬性

範例

下列程式碼範例將示範如何設定 PickBranch 活動的 Trigger 屬性。 此範例來自 使用挑選活動 範例。

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;
}

適用於