public async void Login(object parameter) { this.Password = (string)parameter; string password = GetMD5(this.Password); user.username = this.UserName; user.password = password; user.verifyCode = this.VerifyCode; ReturnMsg <Token> returnMsg; try { returnMsg = Post <ReturnMsg <Token> >(GetHttpRequestArgsHelper.GetHttpRequestArgs(getToken, user)); } catch (Exception) { returnMsg = new ReturnMsg <Token>() { success = false }; } if (returnMsg.success) { IsNeedLogin = false; ShowMessage(returnMsg.respMsg); user.token = returnMsg.respData.token; user.userId = returnMsg.respData.userId; user.password = this.Password; keyValueSettingManager.WriteSetting(new KeyValueSetting() { KeyId = "JSRMUserInfo", ValueText = JsonHelper.SerializeObject(user) }); ReturnMsg <PageOrder> returnMsg1 = await ExecuteGetOrderJob.GetOrder(this.UserName, queryAuthProblemList, user.token, user.userId); if (returnMsg1.success) { ExecuteGetOrderJob.AddOrder(returnMsg1.respData.data); } } else { Notice.Show(returnMsg.respMsg, "通知", 3, MessageBoxIcon.Warning); } }
public async void Load() { if (string.IsNullOrEmpty(user.token)) { IsNeedLogin = true; ShowMessage("请重新登录"); return; } ReturnMsg <PageOrder> returnMsg = await ExecuteGetOrderJob.GetOrder(this.UserName, queryAuthProblemList, user.token, user.userId); if (returnMsg.success) { IsNeedLogin = false; ShowMessage("Token有效,已自动登陆"); ExecuteGetOrderJob.AddOrder(returnMsg.respData.data); StartTask(null); } else { IsNeedLogin = true; ShowMessage("Token失效,请重新登录"); } }