Add back button to create report view; fix change title not warning about unsaved

This commit is contained in:
2026-04-21 11:31:33 +09:00
parent d99fefe74d
commit 14fc5b29ee
3 changed files with 22 additions and 18 deletions
@@ -111,9 +111,10 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
set
{
_pdfReport.Title = value;
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(IsTitleBoxVisible));
NotifyPropertyChanged(nameof(CanAddItem));
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(IsTitleBoxVisible));
NotifyPropertyChanged(nameof(CanAddItem));
HasUnsavedWork = true;
}
}
@@ -341,19 +342,6 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled));
}
public async Task ShowSettings()
{
var updatedSettings = await DialogHost.Show(new SettingsViewModel(_settings, TopLevelGrabber));
if (updatedSettings != null)
{
_settings = (Settings)updatedSettings;
await _settings.SaveSettingsAsync();
LogInfo("Saved updated settings!");
NotifyPropertyChanged(nameof(DataGridDateFormat));
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
}
}
// https://github.com/AvaloniaUI/Avalonia/issues/10075
public void EditFileProperties(object f) => EditFilePropertiesImpl((ReportFile)f);
public async void EditFilePropertiesImpl(ReportFile file)
@@ -634,6 +622,15 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
IsCreatingPDF = false;
}
public async void ReturnToMainMenu()
{
bool isSafeToReturn = await CheckIsSafeToShutdown();
if (isSafeToReturn)
{
PopViewModel();
}
}
public async Task<bool> CheckIsSafeToShutdown()
{
if (!HasUnsavedWork || string.IsNullOrWhiteSpace(WorkingFolder))