WorkflowRuntime.WorkflowAborted 事件

定义

在中止工作流实例时发生。Occurs when a workflow instance is aborted.

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

事件类型

EventHandler<WorkflowEventArgs>

示例

下面的代码示例演示如何使用工作流宿主中的 WorkflowRuntime 功能。The following code example demonstrates how to use WorkflowRuntime functionality from a workflow host. 该代码将 WorkflowAborted 与一个事件处理程序即一个名为 OnWorkflowAborted 的方法相关联。The code associates the WorkflowAborted with an event handler, a method named OnWorkflowAborted.

此代码示例是 取消工作流 示例的一部分。This code example is part of the Canceling a Workflow sample.

workflowRuntime.WorkflowAborted += OnWorkflowAborted;
AddHandler workflowRuntime.WorkflowAborted, AddressOf OnWorkflowAborted

注解

在工作流实例的所有挂起工作被清除之后,但在内存中验证工作流实例之前,会发生 WorkflowAbortedWorkflowAborted occurs after all pending work for the workflow instance is cleared, but before the workflow instance is invalidated in memory. 通过调用 WorkflowInstance.Abort 可以中止工作流实例。You can abort a workflow instance by calling WorkflowInstance.Abort.

在此事件中,发送方包含 WorkflowRuntime,而 WorkflowEventArgs 包含与事件关联的 WorkflowInstanceFor this event, the sender contains the WorkflowRuntime and WorkflowEventArgs contains the WorkflowInstance associated with the event.

有关处理事件的详细信息,请参阅 处理和引发事件For more information about handling events, see Handling and raising events.

适用于