private void AutomaticLogin(string jobName) { AutomaticCount--; if (AutomaticCount < 0) { return; } var validateCodeImg = qiche.ValidateCode(); var validatecode = DaMa(validateCodeImg); var result = qiche.Login(Tool.userInfo_qc.UserName, Tool.userInfo_qc.PassWord, validatecode); if (!result.Result) { if (result.Message.Contains("验证码输入有误")) { AutomaticLogin(jobName); } } else { DateTime dtnow = DateTime.Now; bool isOver = (dtnow - Tool.userInfo_qc.DueTime.Value).TotalSeconds >= 0; AutomaticCount = 20; CheckSendOrder(Tool.userInfo_qc, isOver); CheckSendPrice(Tool.userInfo_qc, isOver); CheckSendNews(Tool.userInfo_qc, isOver); if (string.IsNullOrWhiteSpace(lblQD_QC.Text)) { btnSendOrder_Click(new object(), new EventArgs()); } } }
private void button1_Click(object sender, EventArgs e) { ViewResult result = new ViewResult(); if (Tool.site == Aide.Site.Qiche) { result = qiche.Login(txtUserName.Text, txtPassword.Text, txtCode.Text); } else { result = yiche.Login(txtUserName.Text, txtPassword.Text, txtCode.Text); } if (!result.Result) { MessageBox.Show(result.Message); if (result.Message.Contains("验证码输入有误")) { LoadValidateCode(); } } else { if (chkSavePass.Checked) { if (Tool.site == Aide.Site.Qiche) { qiche.SavePw(); } else { yiche.SavePw(); } } this.DialogResult = DialogResult.OK; } }