示例#1
0
        private void HighScoreClick(object sender, RoutedEventArgs e)
        {
            Sound.Play(Sounds.Click);
            var grid = new Grid();
            grid.RowDefinitions.Add(new RowDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(300, GridUnitType.Pixel)});
            grid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(250, GridUnitType.Pixel)});

            _dialog = new Dialog {DialogContents = {Content = grid}, Header = {Text = Strings.HighScore}};
            _dialog.Loading(LayoutRoot);

            var statistics = new StatisticsClient();
            statistics.GetHighscoresCompleted += GetAllTimeHighCompleted;
            statistics.GetHighscoresAsync(Game.HighScore, null, null);
        }
示例#2
0
 private void UpdateHighscore()
 {
     var statistics = new StatisticsClient();
     statistics.GetHighscoresCompleted += GetHighscoreCompleted;
     statistics.GetHighscoresAsync(1, new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1), null);
 }
示例#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);
        }