private void btnSubmit_Click(object sender, EventArgs e) { string username = txtUsername.Text; if (username.Length <= MIN_NAME_LENGTH || username.Length > MAX_NAME_LENGTH) { lblPrompt.Text = "Your username must be 1-4 characters in length"; txtUsername.Text = ""; } else { //Make username all caps username.ToUpper(); //But for now just create a player StatsPlayer currentPlayer = new StatsPlayer(username); //We want this currentPlayer to be Global and persist across windows //Do we need to make a constructor for the frmGame to accept a StatsPlayer //as an option? // hiding frmStatsPrompt Hide(); //Finally open the game frmGame game = new frmGame(username); //create an instance game.ShowDialog(); //show the form // close username input form Close(); } }
private void btnNo_Click(object sender, EventArgs e) { // hiding frmStatsPrompt Hide(); // do not take their name, play the game frmGame game = new frmGame(); //create an instance game.ShowDialog(); //show the form // close frmMainMenu Close(); }