예제 #1
0
        protected virtual void OnRegisterResult(ReceivedRegisterResultEventArgs e)
        {
            var result = this.ReceivedRegisterResult;

            if (result != null)
            {
                result(this, e);
            }
        }
예제 #2
0
        private void OnReceivedRegisterResult(object sender, ReceivedRegisterResultEventArgs e)
        {
            Invoke ((Action)(() =>
            {
                this.client.CurrentUser.ReceivedRegisterResult -= OnReceivedRegisterResult;

                this.loading.Visible = false;
                this.okButton.Enabled = true;

                if (e.Result == RegisterResult.Success)
                {
                    DialogResult = DialogResult.Abort;
                    Close();
                }
                else
                {
                    switch (e.Result)
                    {
                        case RegisterResult.FailedPassword:
                            this.password.BackColor = Color.Red;
                            new EditBalloon (this.password) { Title = "Registration Error", Text = "The entered password was invalid.", Icon = TooltipIcon.Warning }.Show();
                            break;

                        case RegisterResult.FailedNotApproved: // TODO Probably shouldn't let them get here.
                            Close();
                            MessageBox.Show ("The administrator has not approved you for registration", "Registration", MessageBoxButtons.OK,
                                             MessageBoxIcon.Exclamation);
                            break;

                        case RegisterResult.FailedUsername:
                            this.username.BackColor = Color.Red;
                            new EditBalloon (this.username) { Title = "Registration Error", Text = "The entered username was invalid.", Icon = TooltipIcon.Warning }.Show();
                            break;

                        case RegisterResult.FailedUsernameInUse:
                            this.username.BackColor = Color.Red;
                            new EditBalloon (this.username) { Title = "Registration Error", Text = "The entered username is already in use.", Icon = TooltipIcon.Warning }.Show();
                            break;

                        case RegisterResult.FailedUnknown:
                        case RegisterResult.FailedUnsupported:
                            DialogResult = DialogResult.Abort;
                            Close();
                            MessageBox.Show ("Either the server does not support registration, or something went really terribly wrong.",
                                             "Registration", MessageBoxButtons.OK,
                                             MessageBoxIcon.Error);
                            break;
                    }
                }
            }));
        }
예제 #3
0
 protected virtual void OnRegisterResult(ReceivedRegisterResultEventArgs e)
 {
     var result = this.ReceivedRegisterResult;
     if (result != null)
         result (this, e);
 }