Udostępnij za pośrednictwem


Event-based Asynchronous Pattern Technology Sample

This sample demonstrates how to use components that support the Event-based Asynchronous Pattern.

The Event-based Asynchronous Pattern provides an event-driven programming model for performing asynchronous operations. With this model, you can build asynchronous functionality into your applications at design time. For more information, see Multithreaded Programming with the Event-based Asynchronous Pattern.

For information about using the samples, see the following topics:

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build and run the sample using the command prompt

  1. At the command prompt, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the EventBasedAsyncSample directory.

  3. Type msbuild to build the sample using the solution (.sln) file provided.

  4. Type cd EventBasedAsyncSample<lang>\bin\Debug to navigate to the location of the executable file, where <lang> is CS, VB, or JSL, depending on your choice of programming language.

  5. Type EventBasedAsyncSample<lang>.exe to run the sample.

To build and run the sample using Visual Studio

  1. In Windows Explorer, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the EventBasedAsyncSample directory.

  3. Double-click the solution (.sln) file to open it in Visual Studio.

  4. In Visual Studio, press F5 to build and run the sample.

To use the EventBasedAsyncSample form

  • The EventBasedAsyncSample form has four buttons, one for each demonstrated technology. You can run two of the samples immediately by clicking the Async PictureBox Sample or BackgroundWorker Sample button. The other two require the use of Internet Information Services (IIS). If IIS is available, click the Async WebClient Sample or Async Web Service Sample button and follow the instructions to make the provided files available through IIS. For more information about IIS, see ASP.NET and IIS Configuration.

Demonstrates

See Also

Reference

AsyncOperationManager

Other Resources

Multithreaded Programming with the Event-based Asynchronous Pattern