Suspend and Terminate SampleĀ
This sample demonstrates the use of two basic activities: SuspendActivity and TerminateActivity.
The SuspendActivity activity causes a workflow to be suspended. It also causes the workflow runtime's WorkflowSuspended event to be raised, at which point the workflow instance can be resumed. The TerminateActivity activity ends the workflow and causes the workflow's WorkflowTerminated event to be raised.
The first activity in the workflow is a SuspendActivity activity. This is followed by a CodeActivity activity, and it ends with a TerminateActivity activity. When the workflow encounters the SuspendActivity activity, the workflow is suspended and the workflow runtime's WorkflowSuspended event occurs. In the WorkflowSuspended event handler, the host resumes the workflow instance by using the WorkflowInstance.Resume method.
The console output from the sample appears as follows:
To build the sample
Download the sample by clicking Download Sample in this topic.
This extracts the sample project to your local hard disk.
Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.
Go to the source directory of the sample.
At the command prompt, type MSBUILD <Solution file name>.
To run the sample
- In the SDK Command Prompt window, run the .exe file in the SuspendAndTerminate\bin\debug folder (or the SuspendAndTerminate\bin folder for the VB version of the sample), which is located below the main folder for the sample.
See Also
Reference
SuspendActivity
TerminateActivity
Other Resources
Using the Suspend Activity
Using the Terminate Activity
Activities Samples
Windows Workflow Foundation Samples
Send comments about this topic to Microsoft.