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; } } })); }
private void MClient_ReceivedRegisterResult(object sender, ReceivedRegisterResultEventArgs e) { if (e.Result.Success) { this.Dispatcher.Invoke(() => { MessageBox.Show(this, "성공적으로 회원가입 요청을 마쳤습니다.", "가입 요청 성공", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); }); } else { this.Dispatcher.Invoke(() => { MessageBox.Show(this, "ID가 이미 존재합니다.", "가입 실패", MessageBoxButton.OK, MessageBoxImage.Warning); this.IsEnabled = true; }); } mClient.ReceivedRegisterResult -= MClient_ReceivedRegisterResult; }