diff --git a/MarkMpn.Sql4Cds.XTB/DocumentWindowBase.cs b/MarkMpn.Sql4Cds.XTB/DocumentWindowBase.cs index cdd2f22c..282eece7 100644 --- a/MarkMpn.Sql4Cds.XTB/DocumentWindowBase.cs +++ b/MarkMpn.Sql4Cds.XTB/DocumentWindowBase.cs @@ -148,7 +148,7 @@ protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); - if (Modified && !Settings.Instance.RememberSession && this is ISaveableDocumentWindow saveable) + if (Modified && this is ISaveableDocumentWindow saveable) { using (var form = new ConfirmCloseForm(new[] { DisplayName }, true)) { diff --git a/MarkMpn.Sql4Cds.XTB/PluginControl.cs b/MarkMpn.Sql4Cds.XTB/PluginControl.cs index 59a24c3f..990fa410 100644 --- a/MarkMpn.Sql4Cds.XTB/PluginControl.cs +++ b/MarkMpn.Sql4Cds.XTB/PluginControl.cs @@ -664,15 +664,16 @@ private void SaveSettings() public override void ClosingPlugin(PluginCloseInfo info) { - if (!ConfirmBulkClose(dockPanel.Contents.OfType().Cast().ToArray(), info.Silent)) + if (Settings.Instance.RememberSession) + { + SaveSettings(); + } + else if (!ConfirmBulkClose(dockPanel.Contents.OfType().Cast().ToArray(), info.Silent)) { info.Cancel = true; return; } - if (Settings.Instance.RememberSession) - SaveSettings(); - base.ClosingPlugin(info); } @@ -898,7 +899,7 @@ private bool ConfirmBulkClose(IDockContent[] documents, bool silent) .Where(query => query.Modified) .ToArray(); - if (unsavedDocuments.Length > 0 && !Settings.Instance.RememberSession) + if (unsavedDocuments.Length > 0) { using (var form = new ConfirmCloseForm(unsavedDocuments.Select(query => query.DisplayName).ToArray(), !silent)) {