private void ForecastButtonHandler(object sender, RoutedEventArgs e)
{
// Start fetching the weather forecast asynchronously.
NoArgDelegate fetcher = new NoArgDelegate(
this.FetchWeatherFromServer);
fetcher.BeginInvoke(null, null);
}//见异步调用同步方法
private void FetchWeatherFromServer()
{
// Schedule the update function in the UI thread.
tomorrowsWeather.Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.Normal,
new OneArgDelegate(UpdateUserInterface),
weather);
}//tomorrowsWeather是UI线程的一个control
WPF:
http://msdn2.microsoft.com/en-us/library/ms741870.aspx