WorkflowApplication.Aborted 属性

定义

获取或设置中止工作流实例时调用的 Action<T>Gets or sets the Action<T> that is invoked when the workflow instance is aborted.

public:
 property Action<System::Activities::WorkflowApplicationAbortedEventArgs ^> ^ Aborted { Action<System::Activities::WorkflowApplicationAbortedEventArgs ^> ^ get(); void set(Action<System::Activities::WorkflowApplicationAbortedEventArgs ^> ^ value); };
public Action<System.Activities.WorkflowApplicationAbortedEventArgs> Aborted { get; set; }
member this.Aborted : Action<System.Activities.WorkflowApplicationAbortedEventArgs> with get, set
Public Property Aborted As Action(Of WorkflowApplicationAbortedEventArgs)

属性值

中止工作流实例时调用的操作。The action that is invoked when the workflow instance is aborted.

示例

下面的代码示例检查传递给 WorkflowApplicationAbortedEventArgs 实例的 Aborted 处理程序的 WorkflowApplication,并显示有关工作流中止原因的信息。The following code example inspects the WorkflowApplicationAbortedEventArgs passed into the Aborted handler of a WorkflowApplication instance and displays information about why workflow was aborted.

wfApp.Aborted = delegate(WorkflowApplicationAbortedEventArgs e)
{
    // Display the exception that caused the workflow
    // to abort.
    Console.WriteLine("Workflow {0} Aborted.", e.InstanceId);
    Console.WriteLine("Exception: {0}\n{1}",
        e.Reason.GetType().FullName,
        e.Reason.Message);
};

注解

当由 WorkflowApplication 承载的工作流中止时,将调用 Aborted 处理程序,而不调用 Completed 处理程序。When a workflow hosted by a WorkflowApplication is aborted, the Aborted handler is invoked and the Completed handler is not invoked.

适用于