private void WipeFile(string file, IThreadWorker worker, ProgressContext progress) { FileOperationsController operationsController = new FileOperationsController(persistentState.Current, progress); operationsController.WipeQueryConfirmation += (object sender, FileOperationEventArgs e) => { using (ConfirmWipeDialog cwd = new ConfirmWipeDialog()) { cwd.FileNameLabel.Text = Path.GetFileName(file); DialogResult confirmResult = cwd.ShowDialog(); e.ConfirmAll = cwd.ConfirmAllCheckBox.Checked; if (confirmResult == DialogResult.Yes) { e.Skip = false; } if (confirmResult == DialogResult.No) { e.Skip = true; } if (confirmResult == DialogResult.Cancel) { e.Cancel = true; } } }; operationsController.Completed += (object sender, FileOperationEventArgs e) => { if (CheckStatusAndShowMessage(e.Status, e.OpenFileFullName)) { if (!e.Skip) { persistentState.Current.RemoveRecentFiles(new string[] { e.SaveFileFullName }, progress); } } }; operationsController.WipeFile(file, worker); }