/// <summary> /// Start edit mode for given high score item /// </summary> /// <param name="index">Index in high to edit</param> public void EditItem(int index) { if (index < scoreListBox.Items.Count) { editMode = true; selectedItem = index; selectedLetter = 0; ScoreItem scoreItem = (ScoreItem)scoreListBox.Items[selectedItem]; scoreItem.Highlite = true; UpdateName(); UpdateHint(); } }
/// <summary> /// Creates all WPF controls of the window /// </summary> private void InitializeComponents() { this.Width = SystemMetrics.ScreenWidth; this.Height = SystemMetrics.ScreenHeight; this.Background = new SolidColorBrush(Color.Black); #region Caption Text caption = new Text(nfResource.GetString(nfResource.StringResources.HighScore)); caption.Font = nfResource.GetFont(nfResource.FontResources.Consolas23); caption.ForeColor = Color.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); }