public async Task ViewErrorLogs() { var lastErrorLogPath = Paths.GetLastErrorLogPath(); if (lastErrorLogPath.HasNoValue) { _applicationInteraction.ShowAlert("No error log file available."); return; } await _applicationInteraction.OpenFileWithAssociatedApplication(lastErrorLogPath.Value); }
public async Task <Maybe <string> > ExportAs( IScreen context, CollectionReference collectionReference, IList <DocumentReference> selectedDocuments = null) { if (collectionReference == null) { return(null); } var exportOptions = new CollectionExportOptions(collectionReference.IsFilesOrChunks, selectedDocuments?.Count); var result = await ShowHostDialog(context).For(exportOptions); if (result.Action is "cancel") { return(null); } var itemsToExport = result.Model.GetSelectedRecordsFilter() == 0 ? collectionReference.Items : selectedDocuments; var referenceName = collectionReference.Name; Maybe <string> maybePath = null; switch (result.Model.GetSelectedExportFormat()) { case 0: maybePath = await ExportToJson(itemsToExport, referenceName); break; case 1: maybePath = await ExportToExcel(itemsToExport, referenceName); break; case 2: maybePath = await ExportToCsv(itemsToExport, referenceName); break; case 3: maybePath = await ExportStoredFiles(itemsToExport); break; } if (maybePath.HasValue) { var builder = NotificationInteraction.Default() .HasMessage($"{result.Model.ExportFormat} saved in:\n{maybePath.Value.ShrinkPath(128)}"); if (Path.HasExtension(maybePath.Value)) { builder.Dismiss().WithButton("Open", async button => { await _applicationInteraction.OpenFileWithAssociatedApplication(maybePath.Value); }); } builder.WithButton("Reveal in Explorer", async button => { await _applicationInteraction.RevealInExplorer(maybePath.Value); }) .Dismiss().WithButton("Close", button => { }); builder.Queue(); } return(maybePath); }