private async void RemoveExclusionAsync(string exclusion) { var confirmDiag = new OKCancelPopupViewModel("Do you want to delete File Exclusion " + exclusion + "?", "", "Delete", "No"); if (confirmDiag.ShowDialog() == DialogResult.Cancel) { return; } // User has confirmed the deletion, continue await index.RemoveFileExclusionAsync(exclusion); }
/// <summary> /// Removes the provided Archive from the file index.</summary> private async Task RemoveArchive(ArchiveViewModel archive) { var confirmDiag = new OKCancelPopupViewModel("Do you want to delete Archive " + archive.Label + "?\nThis action cannot be undone.", "", "Delete", "No"); if (confirmDiag.ShowDialog() == DialogResult.Cancel) { return; } // User has confirmed the deletion, continue if (archive != null && archive is ArchiveViewModel && archive.Archive != null) { await Index.RemoveArchiveAsync(archive.Archive); } }
/// <summary> /// Generates the selected report and exports it.</summary> private async Task CreateReport() { if (exportArchives.Count == 0) { var confirmDiag = new OKCancelPopupViewModel("An error occured while creating the report: No archives were selected", "", "OK", "") { ShowCancelButton = false }; confirmDiag.ShowDialog(); return; } IsReportInProgress = true; try { // the report writer returns the path the file was exported to if the process was successful var resultPath = await SelectedReport.Value.ReportFunction(exportArchives, ReportPath); IsReportInProgress = false; if (File.Exists(resultPath)) { System.Diagnostics.Process.Start(resultPath); } } catch (Exception ex) { var confirmDiag = new OKCancelPopupViewModel("An error occured while creating the report: " + ex.InnerException.Message, "", "OK", "") { ShowCancelButton = false }; confirmDiag.ShowDialog(); } finally { IsReportInProgress = false; CancelCommand_Execute(null); } }