public static void Show(Panel parent, string title, UIElement content, EventHandler closed)
 {
     var dialog = new Dialog();
     if (closed != null)
     {
         dialog.Closed += closed;
     }
     dialog.Header.Text = title;
     dialog.DialogContents.Content = content;
     dialog.Show(parent);
 }
        private void StatsClick(object sender, RoutedEventArgs e)
        {
            Sound.Play(Sounds.Click);
            var statistics = new StatisticsClient();
            statistics.GetStatisticsCompleted += GetStatisticsCompleted;
            statistics.GetStatisticsAsync();

            _dialog = new Dialog {DialogContents = {Content = new StackPanel()}, Header = {Text = Strings.Statistics}};
            _dialog.Loading(LayoutRoot);
        }
        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);
        }
        private void GameWin(object sender, EventArgs e)
        {
            GameWon(_game.Round);
            _game.LastMove = null;
            Sound.Play(Sounds.GameWon);

            var statistics = new StatisticsClient();
            statistics.IsHighscoreCompleted += IsHighscoreCompleted;
            statistics.IsHighscoreAsync(_game.Score, Game.HighScore, DateTime.Today.Day);

            var textBlock = new TextBlock
                                {
                                    Style = Styles.BodyText,
                                    Text = String.Format(Strings.GameWinText, _game.Round, _game.Score.ToString("N0"),
                                                         _game.Moves.ToString("N0")) + "\n\n" + Strings.GameWinChecking
                                };

            _dialog = new Dialog
                          {
                              DialogContents = {Content = new StackPanel()},
                              Header = {Text = Strings.GameWinTitle}
                          };
            _dialog.Closed += SubmitHighScore;
            ((StackPanel) _dialog.DialogContents.Content).Children.Add(textBlock);
            _dialog.Show(LayoutRoot);
        }