fix: repository settings did not saved correctly when closing app (#459)

This commit is contained in:
leo 2024-09-11 10:20:12 +08:00
parent 9b47198229
commit 2d611cf988
No known key found for this signature in database
2 changed files with 16 additions and 5 deletions

View file

@ -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();

View file

@ -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);
}