State Machine Communication Sample

Download sample

This sample demonstrates how to use events that are sent from the host application to set the state in a state machine workflow.

In the sample, a simple local service called EventService is used to send an event to the workflow called SetState. When the workflow starts, it immediately idles and listens for the SetState event by using a HandleExternalEventActivity activity. When the event is raised by the host, the workflow resumes execution, sets the state to the workflow's completed state, and exits.

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the StateMachineCommunication\bin\debug folder (or the StateMachineCommunication\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also



Other Resources

Tutorial: Create a State Machine Workflow
Communications Samples

© 2007 Microsoft Corporation. All rights reserved.