Skip to content

Commit 2d611cf

Browse files
committed
fix: repository settings did not saved correctly when closing app (#459)
1 parent 9b47198 commit 2d611cf

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/ViewModels/Launcher.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,21 @@ public Launcher(string startupRepo)
107107
_ignoreIndexChange = false;
108108
}
109109

110+
public void Quit(double width, double height)
111+
{
112+
var pref = Preference.Instance;
113+
pref.Layout.LauncherWidth = width;
114+
pref.Layout.LauncherHeight = height;
115+
pref.Save();
116+
117+
_ignoreIndexChange = true;
118+
119+
foreach (var one in Pages)
120+
CloseRepositoryInTab(one, false);
121+
122+
_ignoreIndexChange = false;
123+
}
124+
110125
public void AddNewTab()
111126
{
112127
var page = new LauncherPage();

src/Views/Launcher.axaml.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,7 @@ protected override void OnKeyUp(KeyEventArgs e)
221221

222222
protected override void OnClosing(WindowClosingEventArgs e)
223223
{
224-
var pref = ViewModels.Preference.Instance;
225-
pref.Layout.LauncherWidth = Width;
226-
pref.Layout.LauncherHeight = Height;
227-
pref.Save();
228-
224+
(DataContext as ViewModels.Launcher)?.Quit(Width, Height);
229225
base.OnClosing(e);
230226
}
231227

0 commit comments

Comments
 (0)