From 5fab18f3a05400ba8ee52fed92d93d3897c01154 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 2 Mar 2025 23:45:12 +0100 Subject: [PATCH] Fix #3414: Apply latest session settings before saving upon closing the main window --- ILSpy/MainWindow.xaml.cs | 3 +++ ILSpy/Search/SearchPaneModel.cs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index e78c4f7f8..298e5ca75 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -102,6 +102,9 @@ namespace ICSharpCode.ILSpy MessageBus.Send(this, new ApplySessionSettingsEventArgs(sessionSettings)); sessionSettings.WindowBounds = this.RestoreBounds; + // store window state in settings only if it's not minimized + if (this.WindowState != WindowState.Minimized) + sessionSettings.WindowState = this.WindowState; sessionSettings.DockLayout.Serialize(new(DockManager)); snapshot.Save(); diff --git a/ILSpy/Search/SearchPaneModel.cs b/ILSpy/Search/SearchPaneModel.cs index a9f5444fc..f27acf105 100644 --- a/ILSpy/Search/SearchPaneModel.cs +++ b/ILSpy/Search/SearchPaneModel.cs @@ -54,6 +54,12 @@ namespace ICSharpCode.ILSpy.Search SearchTerm = e.SearchTerm; Show(); }; + MessageBus.Subscribers += ApplySessionSettings; + } + + private void ApplySessionSettings(object sender, ApplySessionSettingsEventArgs e) + { + e.SessionSettings.SelectedSearchMode = SessionSettings.SelectedSearchMode; } public SearchModeModel[] SearchModes { get; } = [