The sample demonstrates a travel booking application. The ConditionedActivityGroup (CAG) has two code activities: a Car activity and an Airline activity. In the SimpleCAGWorkflow constructor, a "travelNeedType" ArrayList object is populated with the types of travel bookings that are required. By commenting out one or both of the travelNeeds.Add statements, you modify the CAG behavior accordingly. Both the Car and Airline activities have their WhenConditionProperty condition populated with a CodeCondition. The Car activity executes only if the travelNeeds collection has a TravelNeeds.Car entry, and the Airline activity executes only if the travelNeeds collection has a TravelNeeds.Airline entry.
The execution of each activity removes the corresponding entry from the collection. The default UntilCondition condition specifies that the CAG should exit when no children are executing or are ready for execution (based on their WhenConditionProperty conditions). In this sample, this means that the CAG exits when the travelNeeds collection is empty.
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 SimpleCAG\bin\debug folder (or the SimpleCAG\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample..
Other ResourcesUsing the ConditionedActivityGroup
Using Activities to Control Flow
Using Conditions in Workflows
Using Conditions through Code
Tutorial: Use Rules and Conditions
Rules and Conditions Overview
Windows Workflow Foundation Samples
© 2007 Microsoft Corporation. All rights reserved.