Пример #1
0
 private void GetHighscoreCompleted(object sender, GetHighscoresCompletedEventArgs e)
 {
     if (e.Result != null && e.Result.Count > 0)
     {
         DataItem score = e.Result.First();
         HighScore.Text = String.Format(Strings.HighestScore, DateTime.Today.ToString("MMMM"), score.Value,
                                        score.Name);
     }
     else
     {
         HighScore.Text = String.Format(Strings.HighestScore, DateTime.Today.ToString("MMMM"), "-", "-");
     }
 }
Пример #2
0
        private void GetMonthHighCompleted(object sender, GetHighscoresCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                var grid = (Grid) _dialog.DialogContents.Content;
                var panel = new StackPanel();
                panel.SetValue(Grid.RowProperty, 0);
                panel.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(panel);

                var header = new TextBlock
                                 {
                                     Style = Styles.StrongText,
                                     Text = String.Format(Strings.HighScoreMonth, DateTime.Today.ToString("MMMM")),
                                     Margin = new Thickness(0, 0, 0, 5)
                                 };
                panel.Children.Add(header);

                int place = 1;
                foreach (DataItem score in e.Result)
                {
                    AddHighScore(panel, place, score.Name, score.Value);
                    place++;
                }
            }
            _dialog.LoadingCompleted();
        }
Пример #3
0
        private void GetAllTimeHighCompleted(object sender, GetHighscoresCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                var grid = (Grid) _dialog.DialogContents.Content;
                var panel = new StackPanel();
                panel.SetValue(Grid.RowProperty, 0);
                panel.SetValue(Grid.ColumnProperty, 0);
                grid.Children.Add(panel);

                var header = new TextBlock
                                 {
                                     Style = Styles.StrongText,
                                     Margin = new Thickness(0, 0, 0, 5),
                                     Text = Strings.HighScoreAllTime
                                 };
                panel.Children.Add(header);

                int place = 1;
                foreach (DataItem score in e.Result)
                {
                    AddHighScore(panel, place, score.Name, score.Value);
                    place++;
                }
            }
            var statistics = new StatisticsClient();
            statistics.GetHighscoresCompleted += GetMonthHighCompleted;
            statistics.GetHighscoresAsync(Game.HighScore, new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1),
                                          null);
        }