示例#1
0
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            newPlayer.Name = UserNameTextBox.Text;
            string email    = EmailTextBox.Text;
            string password = "";

            if (PasswordTextbox.Text.Equals(ConfirmPasswordTextbox.Text))
            {
                password = PasswordTextbox.Text;
            }

            try
            {
                AuthenticationServiceReference.Player player = AuthClient.RegisterPlayer(newPlayer, email, password);
                ConqClient.ClientCredentials.UserName.UserName = UserNameTextBox.Text;
                ConqClient.ClientCredentials.UserName.Password = PasswordTextbox.Text;

                PlayerCredentials.Instance.Player = ConqClient.RetrievePlayer(player.Name);
                this.Hide();
                (new JoinGame(ConqClient)).Show();
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                MessageBox.Show("Error with registering a user: "******"Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }