// method to input player name and start game private void btnPlayerNext_Click(object sender, RoutedEventArgs e) { // if there are players to be made if (players != 0) { // fire event with playername PlayerName?.Invoke(txtboxPlayername.Text, null); txtboxPlayername.Text = ""; players--; txtboxPlayername.Focus(); // if there is no more players to be made if (players == 0) { // sets button to say start btnPlayerNext.Content = "Start"; // sets ui elements to hidden txtboxPlayername.Visibility = Visibility.Hidden; lblPlayerName.Visibility = Visibility.Hidden; // focuses the button QOL btnPlayerNext.Focus(); } } // if there is no players to be made else { // fire event that setup is done Close?.Invoke("", null); } }