/// <summary> /// Shutdown all running RepeatingProcess instances, showing a progress bar /// dialog if this cannot be done immediately, /// </summary> private void ShutdownProcesses() { int stillToDo = RepeatingProcess.PrepareShutdownAll(this.log); if (stillToDo != 0) { new ShuttingDownDialog(stillToDo, this.log).ShowDialog(); } log.Debug("ShutdownProcesses: complete"); }
private void fred_DoWork(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = "Shutdown"; } while (remaining > 0) { this.remaining = RepeatingProcess.PrepareShutdownAll(this.log); worker.ReportProgress(100 - 100 * remaining / tasks); /* deal with any pending Windows messages, which we don't need to know about */ Application.DoEvents(); Thread.Sleep(1000); } }