private async void SignIn(object parameter) { PasswordBox password = parameter as PasswordBox; if (string.IsNullOrWhiteSpace(password.Password) || string.IsNullOrWhiteSpace(UserName)) { MessageBox.Show("用户名或密码为空", "输入错误", MessageBoxButton.OK, MessageBoxImage.Error); return; } JupiterClient jupiterClient = new JupiterClient(); var result = await jupiterClient.SignIn(UserName, password.Password); if (result.Code == 200 && !string.IsNullOrWhiteSpace(result.Data)) { if (!JupiterClient.IsUser) { MessageBox.Show("您没有获得太阳码分销系统的使用许可", "未开通该服务", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } else { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); currentWindow.Close(); } } else { MessageBox.Show(result.Message, "登录失败", MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void ChangePassword(object parameter) { var currentWindow = parameter as ChangePasswordDialog; JupiterClient jupiterClient = new JupiterClient(); var x = await jupiterClient.ChangePassword(JupiterClient.Md5(currentWindow.OldPassword.Password), JupiterClient.Md5(currentWindow.NewPassword.Password)); if (x.Code == 200) { MessageBox.Show("修改成功", "成功", MessageBoxButton.OK, MessageBoxImage.Information); currentWindow.Close(); } else { MessageBox.Show(x.Message, "失败", MessageBoxButton.OK, MessageBoxImage.Error); } }