Skip to content

Commit

Permalink
Merge pull request #350 from DHancock/dev
Browse files Browse the repository at this point in the history
Use WindowCount
  • Loading branch information
DHancock authored Apr 19, 2024
2 parents 708dcb9 + f80b093 commit 5dd2afc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions SudokuSolver/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ internal void RegisterWindow(MainWindow window)
currentWindow = window;
}

internal bool UnRegisterWindow(MainWindow window)
internal void UnRegisterWindow(MainWindow window)
{
appClosing = windowList.Count == 1;

Expand All @@ -221,8 +221,6 @@ internal bool UnRegisterWindow(MainWindow window)
{
currentWindow = windowList.LastOrDefault();
}

return appClosing;
}

public int WindowCount => windowList.Count;
Expand Down
4 changes: 2 additions & 2 deletions SudokuSolver/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ private async void Tabs_TabItemsChangedAsync(TabView sender, IVectorChangedEvent

AppWindow.Hide();

bool isLastWindow = App.Instance.UnRegisterWindow(this);
App.Instance.UnRegisterWindow(this);

if (isLastWindow)
if (App.Instance.WindowCount == 0)
{
await Settings.Data.SaveAsync();
}
Expand Down

0 comments on commit 5dd2afc

Please sign in to comment.