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) |