PickBranch 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在 Pick 活動內執行的潛在路徑。
public ref class PickBranch sealed
C#
[System.Windows.Markup.ContentProperty("Action")]
public sealed class PickBranch
[<System.Windows.Markup.ContentProperty("Action")>]
type PickBranch = class
Public NotInheritable Class PickBranch
- 繼承
-
PickBranch
- 屬性
下列程式碼範例將示範如何建立 PickBranch 活動。 此範例來自 使用挑選活動 範例。
C#
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;
}
PickBranch 包含 Trigger 與 Action。 在元素執行開始時 Pick ,會排程所有元素的所有 PickBranch 觸發程序活動。 當第一個 (最左邊) 活動完成時,會排程對應的動作活動,並取消所有其他觸發活動。
Pick |
建立 PickBranch 活動的新執行個體。 |
Action |
當觸發此分支以執行時,要一併執行的 Activity。 |
Display |
此分支顯示於活動設計工具中的名稱。 |
Trigger |
完成時會啟動此選取分支的活動。 |
Variables |
與此活動相關聯的使用者定義變數集合。 |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Get |
做為預設雜湊函式。 (繼承來源 Object) |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
To |
傳回代表目前物件的字串。 (繼承來源 Object) |
產品 | 版本 |
---|---|
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |