public void Refresh() { lblTitle.Content = entry.Title; if (entry.Media.Count > 0) { imgHeader.Source = WPFUtil.GetImageFromURL(entry.Media[0], 1280, 720, false); } lblSummary.Text = entry.Summary; if (entry.Developers.Count == 0) { lblDev.Content = "Unknown"; } else { lblDev.Content = string.Join("\n", entry.Developers); } if (entry.Publishers.Count == 0) { lblPub.Content = "Unknown"; } else { lblPub.Content = string.Join("\n", entry.Publishers); } if (entry.ReleaseYear < 0) { lblRel.Content = "Unknown"; } else { lblRel.Content = entry.ReleaseYear; } // stats pnlPlaytime.Visibility = entry.PlaytimeTotalMins == -1 ? Visibility.Collapsed : Visibility.Visible; lblTotalPlaytime.Content = ((float)entry.PlaytimeTotalMins / 60).ToString("0.0") + " hrs"; lblRecentPlaytime.Content = ((float)entry.PlaytimeFortnightMins / 60).ToString("0.0") + " hrs"; // media media = new List <BitmapImage>(); for (int i = 1; i < entry.Media.Count; i++) { media.Add(WPFUtil.GetImageFromURL(entry.Media[i], 1280, 720, false)); } MediaList.ItemsSource = media; MediaList.Items.Refresh(); }
void RefreshGamesList(Dictionary <string, GameEntry> games) { gamesEntries.Clear(); if (games == null) { return; } foreach (var item in games.OrderBy(entry => entry.Value.GetSortingTitle())) { if (item.Value.Hidden && !MainWindow.instance.showHidden) { continue; } gamesEntries.Add(new GameTileEntry() { Title = item.Value.Title, Cover = item.Value.BoxArt == null ? null : WPFUtil.GetImageFromURL(item.Value.BoxArt, 210, 280, true), Slug = item.Key }); } GamesListTile.ItemsSource = gamesEntries; GamesListTile.Items.Refresh(); AllGamesTitle.Content = $"All Games ({gamesEntries.Count})"; }
void RefreshRecentGames(Dictionary <string, GameEntry> games) { gamesEntriesRecent.Clear(); if (games == null) { return; } foreach (var item in games) { gamesEntriesRecent.Add(new GameTileEntry() { Title = item.Value.Title, Cover = item.Value.BoxArt == null ? null : WPFUtil.GetImageFromURL(item.Value.BoxArt, 210, 280, true), Slug = item.Key }); } RecentList.ItemsSource = gamesEntriesRecent; RecentList.Items.Refresh(); pnlRecent.Visibility = gamesEntriesRecent.Count > 0 ? Visibility.Visible : Visibility.Collapsed; }