From: sr55 Date: Sun, 18 Nov 2018 13:51:55 +0000 (+0000) Subject: WinGui: Save Options when the app closes, if the options window was last open and... X-Git-Tag: 1.2.0~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fed19278e06db4a5fa2dffd5a5e513e6c1608197;p=handbrake WinGui: Save Options when the app closes, if the options window was last open and unsaved. --- 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; } }