コード例 #1
0
        private async void buttonChangePassword_Click(object sender, EventArgs e)
        {
            ClearErrorProvidres();
            if (!ValidateUserData())
            {
                return;
            }
            try
            {
                AuthenticationServiceClient client = new AuthenticationServiceClient();
                Form frm = new ProgressForm();
                frm.Show();
                OperationResult serviceResult = await client.ChangePasswordAsync(user, textBoxNewPassword.Text);

                frm.Close();
                if (serviceResult.Success)
                {
                    Close();
                }
                if (serviceResult.Errors.Contains(OperationErrors.PassErr))
                {
                    errorProviderNewPassword.SetError(textBoxNewPassword, "Password is not valid!");
                }
            }
            catch (FaultException exc)
            {
                MessageBox.Show(exc.Message);
            }
        }