/// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } delegate void MDFunc(int i); //after clicking the Go button a set of calls to Func are queued private void Go(object sender, RoutedEventArgs e) { for (int i = 0; i < 10; i++) this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new MDFunc(Func), i); } //each time Func is called (from the dispatcher queue) it should update the button content so the user sees //the task progress void Func(int i) { Stopwatch S = new Stopwatch(); S.Start(); while (S.ElapsedMilliseconds < 500) { } button1.Content = i.ToString(); button1.InvalidateVisual(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)