Пример #1
0
        /// <summary>
        /// Creates all WPF controls of the window
        /// </summary>
        private void InitializeComponents()
        {
            this.Width      = SystemMetrics.ScreenWidth;
            this.Height     = SystemMetrics.ScreenHeight;
            this.Background = new SolidColorBrush(Colors.Black);

            #region Caption
            Text caption = new Text(Resources.GetString(Resources.StringResources.HighScore));
            caption.Font      = Resources.GetFont(Resources.FontResources.Consolas23);
            caption.ForeColor = Colors.Red;
            caption.SetMargin(0, 10, 0, 15);
            caption.TextAlignment = TextAlignment.Center;
            #endregion

            #region Score ListBox
            scoreListBox                     = new ListBox();
            scoreListBox.Background          = this.Background;
            scoreListBox.HorizontalAlignment = HorizontalAlignment.Center;

            foreach (ScoreRecord scoreRecord in parentApp.HighScore.Table)
            {
                ScoreItem scoreItem = new ScoreItem(scoreRecord.Name, scoreRecord.Score);
                scoreItem.Background = scoreListBox.Background;
                scoreListBox.Items.Add(scoreItem);
            }
            #endregion

            #region HintLabel
            hintTextFlow = new TextFlow();
            hintTextFlow.SetMargin(0, 15, 0, 0);
            hintTextFlow.TextAlignment = TextAlignment.Center;
            UpdateHint();
            #endregion

            StackPanel mainStack = new StackPanel(Orientation.Vertical);
            mainStack.HorizontalAlignment = HorizontalAlignment.Center;
            mainStack.Children.Add(caption);
            mainStack.Children.Add(scoreListBox);
            mainStack.Children.Add(hintTextFlow);

            this.Child = mainStack;

            this.Visibility = Visibility.Visible;
            Buttons.Focus(this);
        }
Пример #2
0
        /// <summary>
        /// Creates all WPF controls of the window
        /// </summary>
        private void InitializeComponents()
        {
            this.Width = SystemMetrics.ScreenWidth;
            this.Height = SystemMetrics.ScreenHeight;
            this.Background = new SolidColorBrush(Colors.Black);

            #region Caption
            Text caption = new Text(Resources.GetString(Resources.StringResources.HighScore));
            caption.Font = Resources.GetFont(Resources.FontResources.Consolas23);
            caption.ForeColor = Colors.Red;
            caption.SetMargin(0, 10, 0, 15);
            caption.TextAlignment = TextAlignment.Center;
            #endregion

            #region Score ListBox
            scoreListBox = new ListBox();
            scoreListBox.Background = this.Background;
            scoreListBox.HorizontalAlignment = HorizontalAlignment.Center;

            foreach (ScoreRecord scoreRecord in parentApp.HighScore.Table)
            {
                ScoreItem scoreItem = new ScoreItem(scoreRecord.Name, scoreRecord.Score);
                scoreItem.Background = scoreListBox.Background;
                scoreListBox.Items.Add(scoreItem);
            }
            #endregion

            #region HintLabel
            hintTextFlow = new TextFlow();
            hintTextFlow.SetMargin(0, 15, 0, 0);
            hintTextFlow.TextAlignment = TextAlignment.Center;
            UpdateHint();
            #endregion

            StackPanel mainStack = new StackPanel(Orientation.Vertical);
            mainStack.HorizontalAlignment = HorizontalAlignment.Center;
            mainStack.Children.Add(caption);
            mainStack.Children.Add(scoreListBox);
            mainStack.Children.Add(hintTextFlow);

            this.Child = mainStack;

            this.Visibility = Visibility.Visible;
            Buttons.Focus(this);
        }