IfElseActivity 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*
有條件地執行類型為 IfElseBranchActivity的兩個或多個活動之一。 無法繼承這個類別。
public ref class IfElseActivity sealed : System::Workflow::ComponentModel::CompositeActivity, System::Workflow::ComponentModel::IActivityEventListener<System::Workflow::ComponentModel::ActivityExecutionStatusChangedEventArgs ^>
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.Activities.IfElseActivity), "Resources.Decision.png")]
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.IfElseValidator))]
public sealed class IfElseActivity : System.Workflow.ComponentModel.CompositeActivity, System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.ActivityExecutionStatusChangedEventArgs>
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.Activities.IfElseActivity), "Resources.Decision.png")]
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.IfElseValidator))]
[System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public sealed class IfElseActivity : System.Workflow.ComponentModel.CompositeActivity, System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.ActivityExecutionStatusChangedEventArgs>
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.Activities.IfElseActivity), "Resources.Decision.png")>]
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.IfElseValidator))>]
type IfElseActivity = class
inherit CompositeActivity
interface IActivityEventListener<ActivityExecutionStatusChangedEventArgs>
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.Activities.IfElseActivity), "Resources.Decision.png")>]
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.IfElseValidator))>]
[<System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")>]
type IfElseActivity = class
inherit CompositeActivity
interface IActivityEventListener<ActivityExecutionStatusChangedEventArgs>
Public NotInheritable Class IfElseActivity
Inherits CompositeActivity
Implements IActivityEventListener(Of ActivityExecutionStatusChangedEventArgs)
- 繼承
- 屬性
- 實作
範例
下列程式代碼範例示範如何建立 IfElseActivity 類別的新實例,並將兩個 IfElseBranchActivity 類別加入其中。 此程式代碼範例是來自 SequentialWorkflow.cs 檔案之 SequentialWorkflowWithParameters SDK 範例的一部分。 如需詳細資訊,請參閱使用參數範例
this.CanModifyActivities = true;
System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
this.ifElseActivity = new System.Workflow.Activities.IfElseActivity();
this.approveIfElseBranch = new System.Workflow.Activities.IfElseBranchActivity();
this.rejecteIfElseBranch = new System.Workflow.Activities.IfElseBranchActivity();
this.approve = new System.Workflow.Activities.CodeActivity();
this.reject = new System.Workflow.Activities.CodeActivity();
//
// ifElseActivity
//
this.ifElseActivity.Activities.Add(this.approveIfElseBranch);
this.ifElseActivity.Activities.Add(this.rejecteIfElseBranch);
this.ifElseActivity.Name = "ifElseActivity";
Me.CanModifyActivities = True
Dim codecondition1 As System.Workflow.Activities.CodeCondition = New System.Workflow.Activities.CodeCondition
Me.ifElseActivity = New System.Workflow.Activities.IfElseActivity
Me.approveIfElseBranch = New System.Workflow.Activities.IfElseBranchActivity
Me.rejecteIfElseBranch = New System.Workflow.Activities.IfElseBranchActivity
Me.approve = New System.Workflow.Activities.CodeActivity
Me.reject = New System.Workflow.Activities.CodeActivity
'
' ifElseActivity
'
Me.ifElseActivity.Activities.Add(Me.approveIfElseBranch)
Me.ifElseActivity.Activities.Add(Me.rejecteIfElseBranch)
Me.ifElseActivity.Name = "ifElseActivity"
備註
注意
此數據會討論已過時的類型和命名空間。 如需詳細資訊,請參閱 windows Workflow Foundation 4.5中
此活動提供類似兩個 If-ElseIf
語句的語意。
IfElseActivity 包含一組已排序的 IfElseBranchActivity 類別,並在條件評估為 true
時執行第一個分支。 最後一個分支不需要有條件,在此情況下,它一律會評估為 true
。
如果不符合任何條件,則 IfElseActivity 不需要執行任何子活動即可完成。
建構函式
IfElseActivity() |
已淘汰.
初始化 IfElseActivity 類別的新實例。 |
IfElseActivity(String) |
已淘汰.
使用活動的名稱,初始化 IfElseActivity 類別的新實例。 |
屬性
方法
事件
Canceling |
已淘汰.
發生於取消活動執行時。 (繼承來源 Activity) |
Closed |
已淘汰.
發生於 Activity 已完成執行時。 (繼承來源 Activity) |
Compensating |
已淘汰.
在 Activity上執行補償方法時發生。 (繼承來源 Activity) |
Executing |
已淘汰.
執行 Activity 時發生。 (繼承來源 Activity) |
Faulting |
已淘汰.
在實例執行期間引發例外狀況時發生。 (繼承來源 Activity) |
StatusChanged |
已淘汰.
發生於執行中 Activity 的 ActivityExecutionStatus 變更時。 (繼承來源 Activity) |
明確介面實作
IActivityEventListener<ActivityExecutionStatusChangedEventArgs>.OnEvent(Object, ActivityExecutionStatusChangedEventArgs) |
已淘汰.
定義變更活動執行狀態時的處理程式。 |
IComponent.Disposed |
已淘汰.
表示處理元件 Disposed 事件的方法。 (繼承來源 DependencyObject) |