Using Procedural Activities

This topic applies to Windows Workflow Foundation 4 (WF4).

The sample uses the Sequence, Assign, If, While, Switch, TryCatch, and WriteLine activities to implement a guessing game. The guessing game selects a random number and the player has to guess that number. When the player submits an incorrect guess, the workflow provides a hint whether to guess higher or lower. If the player guesses the number in less than 7 attempts, a special congratulations is displayed to the user.

Custom Activities in this Sample

ReadLine

Reads a line of text from the console. This activity derives from the NativeActivity class and creates a bookmark that is resumed by the console application when a line is read.

PromptInt

Prompts the user to type in a number and then reads it from a console window. The activity derives from Activity and uses the WriteLine and ReadLine activities.

To use this sample

  1. Using Visual Studio 2010, open the GuessingGame.sln solution file.

  2. To build the solution, press CTRL+SHIFT+B.

  3. To run the solution, press CTRL+F5.

Dd807377.Important(en-us,VS.100).gif Note:
The samples may already be installed on your machine. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\Built-InActivities\Procedurals

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft