From fed19278e06db4a5fa2dffd5a5e513e6c1608197 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 18 Nov 2018 13:51:55 +0000 Subject: [PATCH] WinGui: Save Options when the app closes, if the options window was last open and unsaved. --- .../ViewModels/Interfaces/IOptionsViewModel.cs | 2 ++ win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs | 13 +++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs index 827d0a0fb..ee2379045 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs @@ -33,5 +33,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// Refresh certain UI controls that can be updated outside preferences. /// void UpdateSettings(); + + void Close(); } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index b646bf552..60706c3fd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -202,20 +202,17 @@ namespace HandBrakeWPF.ViewModels if (result == MessageBoxResult.Yes) { processor.Stop(); - if (this.MainViewModel != null) - { - this.MainViewModel.Shutdown(); - } + this.MainViewModel?.Shutdown(); return true; } return false; } - if (this.MainViewModel != null) - { - this.MainViewModel.Shutdown(); - } + this.OptionsViewModel?.Close(); + + this.MainViewModel?.Shutdown(); + return true; } } -- 2.40.0