private bool ChangePassword() { bool changeResult = false; try { var errCode = 0; string errMsg = string.Empty; Stopwatch stopWatch = new Stopwatch(); stopWatch.Restart(); //ChangePasswordInput input = new ChangePasswordInput //{ // newPwd = NewPassword, // oldPwd = Password, // version = GlobalVariable.Version, // token = AntSdkService.AntSdkLoginOutput.token, // userId = AntSdkService.AntSdkCurrentUserInfo.userId //}; //ChangePasswordOutput output = new ChangePasswordOutput(); //TODO:AntSdk_Modify //DONE:AntSdk_Modify AntSdkChangePasswordInput changePasswordInput = new AntSdkChangePasswordInput(); changePasswordInput.newPassword = NewPassword; changePasswordInput.password = Password; var isResult = AntSdkService.AntSdkChangePassword(changePasswordInput, ref errCode, ref errMsg); if (isResult) { changeResult = true; string errMessage = string.Empty; List <AccountInfo> listAccountInfo = new List <AccountInfo>(); DataConverter.XmlToEntity(Environment.CurrentDirectory + "/AccountCache.xml", ref listAccountInfo, ref errMessage); if (listAccountInfo.Any()) { if (AntSdkService.AntSdkCurrentUserInfo != null) { AccountInfo info = listAccountInfo.FirstOrDefault( c => c.ID == AntSdkService.AntSdkCurrentUserInfo.loginName); if (info != null) { info.LastLoginTime = DateTime.Now; info.OnLine = 0; info.RememberPwd = false; info.AutoLogin = false; info.Password = string.Empty; } DataConverter.EntityToXml <List <AccountInfo> >( System.Environment.CurrentDirectory + "/AccountCache.xml", listAccountInfo, ref errMessage); } } } //if ((new HttpService()).ChangePassword(input, ref output, ref errMsg)) //{ // changeResult = true; // string errMessage = string.Empty; // List<AccountInfo> listAccountInfo = new List<AccountInfo>(); // DataConverter.XmlToEntity(Environment.CurrentDirectory + "/AccountCache.xml", ref listAccountInfo, ref errMessage); // if (listAccountInfo.Any()) // { // if (AntSdkService.AntSdkCurrentUserInfo != null) // { // AccountInfo info = listAccountInfo.FirstOrDefault(c => c.ID == AntSdkService.AntSdkCurrentUserInfo.loginName); // if (info != null) // { // info.LastLoginTime = DateTime.Now; // info.OnLine = 0; // info.RememberPwd = false; // info.AutoLogin = false; // info.Password = string.Empty; // } // DataConverter.EntityToXml<List<AccountInfo>>(System.Environment.CurrentDirectory + "/AccountCache.xml", listAccountInfo, ref errMessage); // } // } //} stopWatch.Stop(); LogHelper.WriteDebug(string.Format("[ChangePassword failed ({0}毫秒)]", stopWatch.Elapsed.TotalMilliseconds)); ErrMsg = errMsg; } catch (Exception ex) { changeResult = false; ErrMsg = $"修改密码时发生异常:{ex.Message}"; LogHelper.WriteError(ErrMsg); } return(changeResult); }