/// <summary> /// Show Achievements for the selected game. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListviewGames_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListGames GameSelected = (ListGames)((ListBox)sender).SelectedItem; if (GameSelected != null) { listAchievementBorder.BorderThickness = new Thickness(0); Guid GameId = Guid.Parse(GameSelected.Id); GameAchievements GameAchievements = AchievementsDatabase.Get(GameId); List <Achievements> ListAchievements = GameAchievements.Achievements; SuccessStory_Achievements_List.Children.Clear(); SuccessStory_Achievements_List.Children.Add(new SuccessStoryAchievementsList(ListAchievements, this)); SuccessStory_Achievements_List.UpdateLayout(); AchievementsGraphicsDataCount GraphicsData = AchievementsDatabase.GetCountByMonth(GameId); string[] StatsGraphicsAchievementsLabels = GraphicsData.Labels; SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection(); StatsGraphicAchievementsSeries.Add(new LineSeries { Title = "", Values = GraphicsData.Series }); SuccessStory_Achievements_Graphics_Game.Children.Clear(); SuccessStory_Achievements_Graphics_Game.Children.Add(new SuccessStoryAchievementsGraphics(StatsGraphicAchievementsSeries, StatsGraphicsAchievementsLabels, this)); SuccessStory_Achievements_Graphics_Game.UpdateLayout(); GC.Collect(); } }
/// <summary> /// Show Achievements for the selected game. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListviewGames_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListViewGames GameSelected = (ListViewGames)((ListBox)sender).SelectedItem; if (GameSelected != null) { listAchievementBorder.BorderThickness = new Thickness(0); Guid GameId = Guid.Parse(GameSelected.Id); GameAchievements GameAchievements = AchievementsDb.Get(GameId); List <Achievements> ListAchievements = GameAchievements.Achievements; SuccessStory_Achievements_List.Children.Clear(); SuccessStoryAchievementsList successStoryAchievementsList = new SuccessStoryAchievementsList(); successStoryAchievementsList.SetScData(ListAchievements, false, settings.EnableRaretyIndicator); SuccessStory_Achievements_List.Children.Add(successStoryAchievementsList); SuccessStory_Achievements_List.UpdateLayout(); AchievementsGraphicsDataCount GraphicsData = null; if (settings.GraphicAllUnlockedByDay) { GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitle"); GraphicsData = AchievementsDb.GetCountByMonth(GameId); } else { GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitleDay"); GraphicsData = AchievementsDb.GetCountByDay(GameId, 8); } string[] StatsGraphicsAchievementsLabels = GraphicsData.Labels; SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection(); StatsGraphicAchievementsSeries.Add(new LineSeries { Title = string.Empty, Values = GraphicsData.Series }); SuccessStory_Achievements_Graphics_Game.Children.Clear(); settings.IgnoreSettings = true; SuccessStory_Achievements_Graphics_Game.Children.Add(new SuccessStoryAchievementsGraphics(StatsGraphicAchievementsSeries, StatsGraphicsAchievementsLabels, settings)); SuccessStory_Achievements_Graphics_Game.UpdateLayout(); GC.Collect(); } }
protected override void OnClosing(CancelEventArgs e) { AchievementsDatabase = null; PlayniteApi = null; PlayniteApiDatabase = null; PlayniteApiPaths = null; ListviewGames.ItemsSource = null; ListviewGames.UpdateLayout(); SuccessStory_Achievements_List.Children.Clear(); SuccessStory_Achievements_List.UpdateLayout(); SuccessStory_Achievements_Graphics_Game.Children.Clear(); SuccessStory_Achievements_Graphics_Game.UpdateLayout(); GC.Collect(); }