Assembly: System.Workflow.Runtime (in system.workflow.runtime.dll)
/** @event */ public void add_WorkflowTerminated (EventHandler<WorkflowTerminatedEventArgs> value) /** @event */ public void remove_WorkflowTerminated (EventHandler<WorkflowTerminatedEventArgs> value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
The workflow can be terminated by the host through a call to the Terminate method, by a TerminateActivity activity, or by the workflow runtime engine when an unhandled exception occurs. The workflow runtime engine raises the WorkflowTerminated event after the workflow instance has been terminated, but before it is invalidated in memory.
For the WorkflowPersisted event, sender will contain the WorkflowRuntime and WorkflowTerminatedEventArgs will contain the WorkflowInstance and information about the reason the instance was terminated in the WorkflowTerminatedEventArgs.Exception property.
For more information about handling events, see Consuming Events.
The following code example demonstrates how you can use WorkflowRuntime functionality from a workflow host. The code associates the WorkflowCompleted with an event handler, a method named OnWorkflowCompleted.
This code example is part of the Canceling a Workflow SDK sample from the Program.cs file. For more information, see Canceling a Workflow.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.