While and Parallel Sample
The sample demonstrates the use of ParallelActivity activities with CodeActivity activities in a WhileActivity activity. Inside the WhileActivity activity, there is a ParallelActivity activity with two SequenceActivity activities, each with a CodeActivity activity. The condition for the while loop is that the execution count is less than or equal to two, which allows the loop to execute two times.
After the workflow instance is started, the condition for the while loop is checked. If the condition evaluates to true, the while loop executes and the sequential activities run. The CodeActivity activities print their status information to the console. After that, the while loop executes again. When the while loop condition evaluates to false, the workflow stops.
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 WhileAndParallel\bin\debug folder (or the WhileAndParallel\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.
© 2007 Microsoft Corporation. All rights reserved.