Delay Sample

Download sample

The sample demonstrates the use of the DelayActivity activity. The DelayActivity activity causes a workflow (or a branch of a workflow) to pause execution for a specified duration. A DelayActivity activity is frequently used to implement a time-out in one branch of a ListenActivity activity, among other uses.

In the sample, a DelayActivity activity is added to a sequential workflow between two CodeActivity activities. The CodeActivity activities print the current time before and after the delay to the console. The DelayActivity is configured for two seconds, and the actual delay time is printed to the console.

The console output appears as follows:

Output from Delay sample

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

See Also

Reference

DelayActivity

Other Resources

Using the DelayActivity Activity
Using Activities to Control Flow
Activities Samples
Windows Workflow Foundation Samples

© 2007 Microsoft Corporation. All rights reserved.