protected override void DoOperation() { Status = "Recovering " + drive.Root + " to " + recoverPath + "..."; int successes; int failures; suppressErrorCheck = true; // tell base class to not report errors, we'll do that here viewModel.ParitySet.Recover(drive.DataDrive, recoverPath, out successes, out failures); if (cancelled) { Status = "Recover cancelled"; return; } if (failures == 0) { string msg = String.Format("{0} file{1} successfully recovered!", successes, successes == 1 ? "" : "s"); MessageWindow.Show(viewModel.Owner, "Recovery complete", msg); } else { string msg = String.Format("{0} file{1} recovered successfully.\r\n\r\n", successes, successes == 1 ? " was" : "s were") + String.Format("{0} file{1} encountered errors during the recovery.", failures, failures == 1 ? "" : "s") + "\r\n\r\nWould you like to see a list of errors?"; if (MessageWindow.Show(viewModel.Owner, "Recovery complete", msg, MessageWindowIcon.Error, MessageWindowButton.YesNo) == true) { ReportWindow.Show(viewModel.Owner, errorMessages); } } Status = String.Format("{0} file{1} recovered ({2} failure{3})", successes, successes == 1 ? "" : "s", failures, failures == 1 ? "" : "s"); }
protected virtual bool CheckForErrors() { if (errorMessages.Count == 0 || suppressErrorCheck) { return(false); } if (MessageWindow.Show(viewModel.Owner, "Errors detected", "Errors were encountered during the " + LowerCaseName + ". Would you like to see a list of errors?", MessageWindowIcon.Error, MessageWindowButton.YesNo) == true) { ReportWindow.Show(viewModel.Owner, errorMessages); } return(true); }
protected override bool CheckForErrors() { if (errorMessages.Count == 0) { return(false); } if (MessageWindow.Show(viewModel.Owner, "Errors detected", "Errors were encountered while trying to remove the drive." + " Would you like to see a list of errors?", MessageWindowIcon.Error, MessageWindowButton.YesNo) == true) { ReportWindow.Show(viewModel.Owner, errorMessages); } return(true); }
internal static void Show(Window owner, List<string> report) { Application.Current.Dispatcher.Invoke(new Action(() => { ReportWindow window = new ReportWindow(); window.Owner = owner; StringBuilder sb = new StringBuilder(); foreach (string s in report) sb.AppendLine(s); window.DataContext = new ReportWindowViewModel(sb.ToString()); window.ShowDialog(); })); }
internal static void Show(Window owner, List <string> report) { Application.Current.Dispatcher.Invoke(new Action(() => { ReportWindow window = new ReportWindow(); window.Owner = owner; StringBuilder sb = new StringBuilder(); foreach (string s in report) { sb.AppendLine(s); } window.DataContext = new ReportWindowViewModel(sb.ToString()); window.ShowDialog(); })); }