Share via


Listen Sample

Download sample

This sample introduces the ListenActivity, which is a composite activity that blocks and waits for one of n child branches to occur. Only one of the branches of a Listen activity will execute.

In this sample, local services are used to pass data into the workflow. The local service interface defines two events: order approval and order rejection. The ListenActivity listens if either of the events occurs. The third branch of the listen waits to see or if a time-out occurs.

The host code randomly picks one of the events (Approve or Reject). If neither is picked, then the time-out branch is executed.

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

See Also

Reference

ListenActivity
DelayActivity

Other Resources

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

© 2007 Microsoft Corporation. All rights reserved.