Beispiel #1
0
        /// <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();
            }
        }
        /// <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    successStories   = PluginDatabase.Get(GameId);
                List <Achievements> ListAchievements = successStories.Items;

                SuccessStory_Achievements_List.Children.Clear();
                SuccessStoryAchievementsList successStoryAchievementsList = new SuccessStoryAchievementsList(true);
                successStoryAchievementsList.SetScData(successStories, true);
                SuccessStory_Achievements_List.Children.Add(successStoryAchievementsList);


                int limit = 0;
                if (!PluginDatabase.PluginSettings.GraphicAllUnlockedByDay)
                {
                    GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitle");
                }
                else
                {
                    GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitleDay");
                    limit = 8;
                }

                SuccessStory_Achievements_Graphics_Game.Children.Clear();
                PluginDatabase.PluginSettings.IgnoreSettings = true;
                SuccessStoryAchievementsGraphics successStoryAchievementsGraphics = new SuccessStoryAchievementsGraphics();
                successStoryAchievementsGraphics.SetScData(GameId, limit);
                SuccessStory_Achievements_Graphics_Game.Children.Add(successStoryAchievementsGraphics);
            }
        }
Beispiel #3
0
        protected override void OnAppearing()
        {
            try
            {
                base.OnAppearing();
                _viewModel.LoadData();

                _nextSchedule = _viewModel.EarliestSchedule();

                foreach (ItemGroup <string, Game> item in ListViewGames.ItemsSource)
                {
                    if (_nextSchedule == item)
                    {
                        ListViewGames.SelectedItem = item?.FirstOrDefault();
                        ListViewGames.ScrollTo(item?.FirstOrDefault(), Xamarin.Forms.ScrollToPosition.Start, true);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }