PickBranch.Action 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當觸發此分支以執行時,要一併執行的 Activity。
public:
property System::Activities::Activity ^ Action { System::Activities::Activity ^ get(); void set(System::Activities::Activity ^ value); };
[System.Windows.Markup.DependsOn("Trigger")]
public System.Activities.Activity Action { get; set; }
[<System.Windows.Markup.DependsOn("Trigger")>]
member this.Action : System.Activities.Activity with get, set
Public Property Action As Activity
屬性值
要執行的活動。
- 屬性
範例
下列程式碼範例將示範如何設定 PickBranch 活動的 Action 屬性。 此範例來自 使用挑選活動 範例。
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;
}