private void MI_Start_Click(object sender, RoutedEventArgs e) { SP_StartTournament.Visibility = Visibility.Visible; SP_SelectMode.Visibility = Visibility.Visible; Grid_GameMenu.Visibility = Visibility.Collapsed; Rtb_Info.Clear(); LB_Players.Items.Clear(); TB_CountOfPlayers.Clear(); TB_PlayerName.Clear(); LB_Results.Items.Clear(); _tournamentData = new TournamentData(); _tournament = null; _printer = new WPFManager(this, _tournamentData); _printer.StartedNewTournament(); }
private void Btn_AddPlayer_Click(object sender, RoutedEventArgs e) { var name = TB_PlayerName.Text; if (name.Length > 12) { Rtb_Info.AppendText("\nThis name is too long. Try again!"); return; } if (!_tournamentData.IsPlayerExists(name)) { _tournamentData.AddPlayer(name); _tournamentData.IndexOfCurrentPlayer++; LB_Players.Items.Add(name); } else { _printer.NameAlreadyExists(); } TB_PlayerName.Clear(); if (_tournamentData.IsAdditionOver()) { SP_AddPlayers.Visibility = Visibility.Collapsed; SP_StartTournament.Visibility = Visibility.Collapsed; Grid_GameMenu.Visibility = Visibility.Visible; _tournament.StartTournament(); } else { _printer.EnterPlayerName(_tournamentData.IndexOfCurrentPlayer); } }
private void Rtb_Info_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { Rtb_Info.SelectionStart = Rtb_Info.Text.Length; Rtb_Info.ScrollToEnd(); }