/// <summary> /// Initializes and opens <see cref="HighscoreWindow"/> /// </summary> /// <param name="sender">Object containing information about sender object</param> /// <param name="args">Object containing arguments</param> private void OnShowHighScoresButtonClick(object sender, RoutedEventArgs args) { var highScoreWindow = new HighscoreWindow(); highScoreWindow.Show(); this.Hide(); }
/// <summary> /// Gets an instance of <see cref="HighscoreLogger"/> class and adds a new entry /// </summary> /// <param name="sender">Object containing information about sender object</param> /// <param name="args">Object containing arguments</param> private void OnSaveButtonClick(object sender, RoutedEventArgs args) { var isValidInput = 3 <= this.UserNameTextBox.Text.Length && this.UserNameTextBox.Text.Length <= 8; if (isValidInput) { HighscoreLogger.Instance.AddHighscore(this.UserNameTextBox.Text, this.data.MovesCount); this.Hide(); var highscoreWindow = new HighscoreWindow(); highscoreWindow.Show(); } else { MessageBox.Show("Name must be betwen 3 and 8 chars long!"); } }