Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- longWorkTextBox.Text = "Ready For Work!";
- Action workAction = delegate
- {
- Console.WriteLine("Starting Work Action");
- int i = int.MaxValue;
- while (i > 0)
- i--;
- Console.WriteLine("Ending Work Action");
- longWorkTextBox.Text = "Work Complete";
- };
- longWorkTextBox.Dispatcher.BeginInvoke(DispatcherPriority.Background, workAction);
- longWorkTextBox.Text = "Ready For Work!";
- Action workAction = delegate
- {
- BackgroundWorker worker = new BackgroundWorker();
- worker.DoWork += delegate
- {
- Console.WriteLine("Starting Slow Work");
- int i = int.MaxValue;
- while (i > 0)
- i--;
- Console.WriteLine("Ending Work Action");
- };
- worker.RunWorkerCompleted += delegate
- {
- longWorkTextBox.Text = "Work Complete";
- };
- worker.RunWorkerAsync();
- };
- longWorkTextBox.Dispatcher.BeginInvoke(DispatcherPriority.Background, workAction);
- BackgroundWorker worker = new BackgroundWorker;
- worker.WorkerReportsProgress = true;
- worker.WorkerSupportsCancellation = true;
- worker.DoWork +=new DoWorkEventHandler(worker_DoWork);
- worker.RunWorkerCompleted +=new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
- worker.ProgressChanged +=new ProgressChangedEventHandler(worker_ProgressChanged);
- bkwkPlayingLoop.RunWorkerAsync();
Add Comment
Please, Sign In to add comment