Partilhar via


State Initialization Sample

Download sample

This sample demonstrates a simple use of the StateInitializationActivity activity. The StateInitializationActivity activity functions much like a typical SequenceActivity activity, except that it is used as the first activity in a state in a StateMachineWorkflowActivity.

The sample creates a simple state machine workflow that has two states: an initial state (StartState), and a completed state (CompletedState). The initial state contains a StateInitializationActivity activity, which in turn contains a CodeActivity activity and a SetStateActivity activity. When the StateInitializationActivity activity executes, the contained activities execute in sequence.

To build the sample

  1. Download the sample by clicking Download Sample in this topic.

    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 StateInitialization\bin\debug folder (or the StateInitialization\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also

Reference

StateInitializationActivity
SetStateActivity

Other Resources

Using the StateInitializationActivity Activity
Using the SetStateActivity Activity
Tutorial: Create a State Machine Workflow
State Machine Workflows
Activities Samples
Windows Workflow Foundation Samples

© 2007 Microsoft Corporation. All rights reserved.