private void registerButton_Click(object sender, EventArgs e) { if (registerButton.Text.Equals("Register")) { if (playerNameTextBox.Text.Equals(null) || playerNameTextBox.Text.Trim().Equals("")) { MessageBox.Show("Player name can't be empty."); return; } if (playerNameTextBox.Text.Trim().Length > 50) { MessageBox.Show("Player name must be less than 50 characters."); return; } RegisterPressed?.Invoke(domainNameTextBox.Text, playerNameTextBox.Text); } else { RegisterCancelPressed?.Invoke(); } }
/// <summary> /// Fired if register button is clicked. /// </summary> private void registerButton_Click(object sender, EventArgs e) { RegisterPressed?.Invoke(nameBox.Text.Trim(), serverBox.Text.Trim()); }