From 236eccf3d13de28d1ff613edd2be7c15bfc0f15c Mon Sep 17 00:00:00 2001 From: Michael Babienco Date: Fri, 24 Apr 2026 12:02:04 +0900 Subject: [PATCH] Better error handling on choose file loc --- src/MayShow.Shared/ViewModels/CreatePDFReportViewModel.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MayShow.Shared/ViewModels/CreatePDFReportViewModel.cs b/src/MayShow.Shared/ViewModels/CreatePDFReportViewModel.cs index e0fdf2b..795374d 100644 --- a/src/MayShow.Shared/ViewModels/CreatePDFReportViewModel.cs +++ b/src/MayShow.Shared/ViewModels/CreatePDFReportViewModel.cs @@ -458,8 +458,9 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger try { var outputFilePath = await DeterminePDFSaveLocation(); - if (outputFilePath == null) + if (outputFilePath == null && _settings.PDFOutputSaveLocation != PDFSaveLocation.AlwaysAsk) { + // if always ask and output is null, they probably hit cancel. await DialogHost.Show(new WarningViewModel("Error: Output file path could not be determined. Current save location set in settings: " + Enum.GetName(_settings.PDFOutputSaveLocation))); } else if (_settings.PDFOutputSaveLocation == PDFSaveLocation.OtherChosenDir && @@ -467,7 +468,7 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger { await DialogHost.Show(new WarningViewModel("Error: Output directory not found! Please adjust the application Settings before continuing. Output directory: " + _settings.OutputPdfDir)); } - else + else if (outputFilePath != null) { await Task.Run(() => CreatePDF(outputFilePath)); } @@ -550,7 +551,7 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger SuggestedFileName = ReportTitle + ".pdf" }); - if (result.File is not null) + if (result.File != null) { // Console.WriteLine("1: {0}", result.File.Path.AbsolutePath); // HTML escaped?! // Console.WriteLine("2: {0}", result.File.Path.AbsoluteUri); // starts with file://