Skip to content

Commit

Permalink
Added some error protection
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Jan 10, 2024
1 parent 204c175 commit 355ed36
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions gamevault/UserControls/GameViewUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ private bool IsGameInstalled(Game? game)
}
private bool IsGameDownloaded(Game? game)
{
if (game == null)
return false;
return DownloadsViewModel.Instance.DownloadedGames.Where(gameUC => gameUC.GetGameId() == game.ID).Count() > 0;
}
private void Back_Click(object sender, MouseButtonEventArgs e)
Expand Down
2 changes: 2 additions & 0 deletions gamevault/UserControls/InstallUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.

private void GameCard_Clicked(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (((KeyValuePair<Game, string>)((FrameworkElement)sender).DataContext).Key == null)
return;
MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(((KeyValuePair<Game, string>)((FrameworkElement)sender).DataContext).Key, LoginManager.Instance.IsLoggedIn()));
}
private void Search_TextChanged(object sender, TextChangedEventArgs e)
Expand Down
6 changes: 4 additions & 2 deletions gamevault/UserControls/LibraryUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public partial class LibraryUserControl : UserControl
private LibraryViewModel ViewModel;
private InputTimer inputTimer { get; set; }

private bool scrollBlocked = false;
private bool scrollBlocked = false;
public LibraryUserControl()
{
InitializeComponent();
Expand Down Expand Up @@ -135,7 +135,7 @@ public InstallUserControl GetGameInstalls()
}
private async Task ProcessGamesData(PaginatedData<Game> gameResult)
{
await Task.Run(async () =>
await Task.Run(() =>
{
foreach (Game game in gameResult.Data)
{
Expand All @@ -159,6 +159,8 @@ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.

private void GameCard_Clicked(object sender, MouseButtonEventArgs e)
{
if ((Game)((FrameworkElement)sender).DataContext == null)
return;
MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl((Game)((FrameworkElement)sender).DataContext));
}

Expand Down

0 comments on commit 355ed36

Please sign in to comment.