private void registerButton_Click(object sender, EventArgs e)
        {
            registerButton.Enabled = false;
            if (codeText.TextLength == 0 || userText.TextLength == 0 || passText.TextLength == 0 || emailText.TextLength == 0)
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_EmptyField), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
                return;
            }
            string response = Networking.SendRequest(Networking.RequestType.Register, codeText.Text + "ͦ" + userText.Text + "ͦ" + LoginForm.CalculateMD5Hash(passText.Text) + "ͦ" + emailText.Text, 2, false);

            if (response == "code")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_CodeErr), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
            }
            else if (response == "uname")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_NameErr), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
            }
            else if (response == "ulen")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_NameLen), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
            }
            else if (response == "plen")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_PassLen), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
            }
            else if (response == "email")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_Email), Language.Translate(Language.StringID.Error));
                registerButton.Enabled = true;
            }
            else if (response == "Success!")
            {
                MessageBox.Show(Language.Translate(Language.StringID.Reg_Success));
                Close();
            }
            else
            {
                new ErrorHandler(ErrorType.ServerError, new Exception(response)); //2015.06.04.
                registerButton.Enabled = true;
            }
        }
示例#2
0
        private void registerButton_Click(object sender, EventArgs e)
        {
            registerButton.Enabled = false;
            if (codeText.TextLength == 0 || userText.TextLength == 0 || passText.TextLength == 0 || emailText.TextLength == 0)
            {
                MessageBox.Show(Language.Translate("reg_emptyfield"), Language.Translate("error"));
                registerButton.Enabled = true;
                return;
            }
            string response = Networking.SendRequest("register", codeText.Text + "ͦ" + userText.Text + "ͦ" + LoginForm.CalculateMD5Hash(passText.Text) + "ͦ" + emailText.Text, 2, false);

            if (response == "code")
            {
                MessageBox.Show(Language.Translate("reg_codeerr"), Language.Translate("error"));
                registerButton.Enabled = true;
            }
            else if (response == "uname")
            {
                MessageBox.Show(Language.Translate("reg_nameerr"), Language.Translate("error"));
                registerButton.Enabled = true;
            }
            else if (response == "ulen")
            {
                MessageBox.Show(Language.Translate("reg_namelen"), Language.Translate("error"));
                registerButton.Enabled = true;
            }
            else if (response == "plen")
            {
                MessageBox.Show(Language.Translate("reg_passlen"), Language.Translate("error"));
                registerButton.Enabled = true;
            }
            else if (response == "email")
            {
                MessageBox.Show(Language.Translate("reg_email"), Language.Translate("error"));
                registerButton.Enabled = true;
            }
            else if (response == "Success!")
            {
                MessageBox.Show(Language.Translate("reg_success"));
                Close();
            }
            else
            {
                MessageBox.Show(Language.Translate("unknown_error") + ":\n" + response);
                registerButton.Enabled = true;
            }
        }