Skip to content

Commit

Permalink
Issue Fix: Favorites page when set as startup page opened as home page
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamboooz committed Dec 5, 2023
1 parent 513b6c1 commit 500d547
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Gavilya/ViewModels/FavPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public bool IsCardSelected

public FavPageViewModel(GameList games, List<Tag> tags, MainViewModel mainViewModel)
{
Games = games;

Games = new GameList(games.Where(game => game.IsFavorite));

_tags = tags;
_mainViewModel = mainViewModel;

Expand Down
3 changes: 2 additions & 1 deletion Gavilya/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ public MainViewModel(Window window, Profile profile, ProfileData profiles, Page?
Games = profile.Games;
CurrentSettings = profile.Settings;

CurrentViewModel = (startupPage is null ? profile.Settings.DefaultPage : startupPage) switch
CurrentViewModel = (startupPage is null ? profile.Settings.DefaultPage : startupPage) switch
{
Page.Library => new LibPageViewModel(Games, profile.Tags, this),
Page.Favorites => new FavPageViewModel(Games, profile.Tags, this),
Page.Recent => new RecentPageViewModel(Games, profile.Tags, this),
Page.Profile => new ProfileViewModel(profile, profiles, Games, this),
_ => new HomePageViewModel(Games, profile.Tags, this)
Expand Down
4 changes: 1 addition & 3 deletions Gavilya/ViewModels/NavBarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ private void LibraryPage(object? obj)

private void FavoritesPage(object? obj)
{
GameList favoriteGames = new GameList(Games.Where(game => game.IsFavorite));

_mainViewModel.CurrentViewModel = new FavPageViewModel(favoriteGames, _tags, _mainViewModel);
_mainViewModel.CurrentViewModel = new FavPageViewModel(Games, _tags, _mainViewModel);
}


Expand Down

0 comments on commit 500d547

Please sign in to comment.