TerminateActivity 构造函数

定义

重载

TerminateActivity()

初始化 TerminateActivity 类的新实例。

TerminateActivity(String)

使用活动名初始化 TerminateActivity 类的新实例。

TerminateActivity()

初始化 TerminateActivity 类的新实例。

public:
 TerminateActivity();
public TerminateActivity ();
Public Sub New ()

示例

此示例演示如何使用 TerminateActivity 的构造函数,以及在别处讨论的与此有关的其他内容。

此代码示例摘自 SuspendAndTerminateWorkflow.Designer.cs 文件中的“挂起和终止 SDK”示例。 有关详细信息,请参阅 使用暂停和终止

[System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
    this.CanModifyActivities = true;
    this.suspend = new System.Workflow.ComponentModel.SuspendActivity();
    this.consoleMessage = new System.Workflow.Activities.CodeActivity();
    this.terminate = new System.Workflow.ComponentModel.TerminateActivity();
    //
    // suspend
    //
    this.suspend.Error = null;
    this.suspend.Name = "suspend";
    //
    // ConsoleMessage
    //
    this.consoleMessage.Name = "consoleMessage";
    this.consoleMessage.ExecuteCode += new System.EventHandler(this.OnConsoleMessage);
    //
    // terminate
    //
    this.terminate.Error = null;
    this.terminate.Name = "terminate";
    //
    // SuspendAndTerminateWorkflow
    //
    this.Activities.Add(this.suspend);
    this.Activities.Add(this.consoleMessage);
    this.Activities.Add(this.terminate);
    this.Name = "SuspendAndTerminateWorkflow";
    this.CanModifyActivities = false;
}
<System.Diagnostics.DebuggerNonUserCode()> _
                            Private Sub InitializeComponent()

    Me.CanModifyActivities = True
    Me.suspend = New System.Workflow.ComponentModel.SuspendActivity()
    Me.consoleMessage = New System.Workflow.Activities.CodeActivity()
    Me.terminate = New System.Workflow.ComponentModel.TerminateActivity()
    ' 
    ' suspend
    ' 
    Me.suspend.Error = Nothing
    Me.suspend.Name = "suspend"
    ' 
    ' ConsoleMessage
    ' 
    Me.consoleMessage.Name = "consoleMessage"
    AddHandler Me.consoleMessage.ExecuteCode, AddressOf Me.OnConsoleMessage
    ' 
    ' terminate
    ' 
    Me.terminate.Error = Nothing
    Me.terminate.Name = "terminate"
    ' 
    ' SuspendAndTerminateWorkflow
    ' 
    Me.Activities.Add(Me.suspend)
    Me.Activities.Add(Me.consoleMessage)
    Me.Activities.Add(Me.terminate)
    Me.Name = "SuspendAndTerminateWorkflow"
    Me.CanModifyActivities = False
End Sub

注解

下表显示了 TerminateActivity 类的某个实例的初始属性值。

属性 “值”
Error Null(在 Visual Basic 中为 Nothing)。

适用于

TerminateActivity(String)

使用活动名初始化 TerminateActivity 类的新实例。

public:
 TerminateActivity(System::String ^ name);
public TerminateActivity (string name);
new System.Workflow.ComponentModel.TerminateActivity : string -> System.Workflow.ComponentModel.TerminateActivity
Public Sub New (name As String)

参数

name
String

活动的用户定义名称。

适用于