diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 25a7846b..1cd7aef3 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -107,6 +107,21 @@ namespace SourceGit.ViewModels _ignoreIndexChange = false; } + public void Quit(double width, double height) + { + var pref = Preference.Instance; + pref.Layout.LauncherWidth = width; + pref.Layout.LauncherHeight = height; + pref.Save(); + + _ignoreIndexChange = true; + + foreach (var one in Pages) + CloseRepositoryInTab(one, false); + + _ignoreIndexChange = false; + } + public void AddNewTab() { var page = new LauncherPage(); diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index 05ea3ca8..359a80fa 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -221,11 +221,7 @@ namespace SourceGit.Views protected override void OnClosing(WindowClosingEventArgs e) { - var pref = ViewModels.Preference.Instance; - pref.Layout.LauncherWidth = Width; - pref.Layout.LauncherHeight = Height; - pref.Save(); - + (DataContext as ViewModels.Launcher)?.Quit(Width, Height); base.OnClosing(e); }