WorkflowRuntime.Stopped 事件

定義

在工作流程執行階段引擎停止時發生。

public:
 event EventHandler<System::Workflow::Runtime::WorkflowRuntimeEventArgs ^> ^ Stopped;
public event EventHandler<System.Workflow.Runtime.WorkflowRuntimeEventArgs> Stopped;
member this.Stopped : EventHandler<System.Workflow.Runtime.WorkflowRuntimeEventArgs> 
Public Custom Event Stopped As EventHandler(Of WorkflowRuntimeEventArgs) 
Public Event Stopped As EventHandler(Of WorkflowRuntimeEventArgs) 

事件類型

範例

在下列範例中,會將事件處理常式加入至 StoppedWorkflowRuntime 事件中。 在這個範例中,處理常式是列印簡易訊息至主控台的匿名方法。

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Add an anonymous method as the event handler for the Stopped event.
workflowRuntime.Stopped += new EventHandler<WorkflowRuntimeEventArgs>(
    delegate { Console.WriteLine("Workflow runtime stopped."); });
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Add a method as the event handler for the Stopped event.
AddHandler workflowRuntime.Stopped, AddressOf RuntimeStopped

備註

StopRuntime 方法會在叫用以其衍生自 Stopped 類別的每個服務實作的 Stop 方法後,引發 WorkflowRuntimeService 事件。 這些工作流程執行階段引擎服務的停止順序不一定,而且這些服務的其中一些服務可能需要保留一些其他服務所依賴的功能,直到其他服務停止為止。 這類服務可以覆寫 WorkflowRuntimeService.OnStopped 方法,以在引發 Stopped 事件時執行任何剩餘的關閉邏輯。

如需處理事件的詳細資訊,請參閱 處理和引發事件

適用於