Apress-Visual CSharp 2010 Recipes A Problem Solution Approach_5
synchronously and BeginInvoke executes the delegate asynchronously. To complete an asynchronous operation initiated using BeginInvoke, you call the Control.EndInvoke method. The BeginInvoke and EndInvoke methods make up a common asynchronous execution pattern known as the Classic Async pattern. The details of this pattern and the options you have available for handling method completion are discussed in recipe 4-2.
The Code
The following example shows how to update a Windows Forms control from multiple threads. The example uses two timers that fire at differing intervals to change the color of a Button control between red and green. The code shows how to use...