共用方式為


SuspendActivity 建構函式

定義

多載

SuspendActivity()

初始化 SuspendActivity 類別的新執行個體。

SuspendActivity(String)

初始化 SuspendActivity 類別的新執行個體,以及該活動的名稱。

SuspendActivity()

初始化 SuspendActivity 類別的新執行個體。

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

範例

這個範例說明使用 SuspendActivity 的建構函式,此型別內的其他內容已於他處討論。

這個程式碼範例是 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

備註

下表所顯示的是 SuspendActivity 類別之執行個體的初始屬性值。

屬性
Error Null (在 Visual Basic 中為 Nothing)。

適用於

SuspendActivity(String)

初始化 SuspendActivity 類別的新執行個體,以及該活動的名稱。

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

參數

name
String

使用者定義的活動名稱。

適用於