/// ------------------------------------------------------------------------------------ protected void PerformBackupOrRestore(Action <int> reportProgressAction, Action finishedAction) { WaitCursor.Show(); LogBox.Clear(); try { using (_worker = new BackgroundWorker()) { _worker.DoWork += PerformBackgroundWork; _worker.WorkerReportsProgress = true; _worker.ProgressChanged += (s, e) => reportProgressAction(e.ProgressPercentage); _worker.RunWorkerCompleted += (s, e) => finishedAction(); _worker.RunWorkerAsync(); while (_worker.IsBusy) { Application.DoEvents(); } } } catch (Exception error) { BackupRestoreException = error; } finally { if (BackupRestoreException != null) { LogBox.Clear(); LogBox.WriteException(BackupRestoreException); } _worker = null; WaitCursor.Hide(); } }