private void btnOk_Click(object sender, EventArgs e) { string authEndPoint = formatEndPoint(txtAuthEndPoint.Text.Trim()); string smsEndPoint = formatEndPoint(txtSmsEndPoint.Text.Trim()); string ismgEndPoint = formatEndPoint(txtISMGEndPoint.Text.Trim()); string connectUrl = authEndPoint + "/"; HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } if (SectionSettingsSave != null) { SectionSettingsSave(this, new SectionSettingsSaveEventArgs { AuthEndPoint = authEndPoint, SmsEndPoint = smsEndPoint, IsmgEndPoint = ismgEndPoint }); } this.DialogResult = DialogResult.OK; this.UIInvoke(() => { this.Close(); }); }); }
private void btn_ok_Click(object sender, EventArgs e) { string authEndPoint = formatEndPoint(txtAuthEndPoint.Text.Trim()); string authSmsEndPoint = formatEndPoint(txtAuthSmsEndPoint.Text.Trim()); string smsEndPoint = formatEndPoint(txtSmsEndPoint.Text.Trim()); string showError = ""; showError = txt_SpCode.Text.Trim(); if (string.IsNullOrEmpty(showError)) { MessageBoxAdapter.ShowError("企业编号不能为空!"); return; } showError = txt_LoginName.Text.Trim(); if (string.IsNullOrEmpty(showError)) { MessageBoxAdapter.ShowError("用户名不能为空!"); return; } showError = txt_Password.Text.Trim(); if (string.IsNullOrEmpty(showError)) { MessageBoxAdapter.ShowError("密码不能为空!"); return; } string txtSmsSetting = "SpCode=" + txt_SpCode.Text.Trim() + "&LoginName=" + txt_LoginName.Text.Trim() + "&Password="******"/"; HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } if (SectionSettingsSave != null) { SectionSettingsSave(this, new SectionSettingsSaveEventArgs { AuthEndPoint = authEndPoint, AuthSmsEndPoint = authSmsEndPoint, SmsEndPoint = smsEndPoint, TxtSmsSetting = txtSmsSetting, }); } this.DialogResult = DialogResult.OK; this.UIInvoke(() => { this.Close(); }); }); }
private void frmMain_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); ismgEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, Common.INI_FILE_PATH); lblMsg.Show(); _tickTimer = new System.Timers.Timer(1 * 200); _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee) { BeginInvoke(new Action(() => { if (lblMsg.Text.IndexOf(".") == -1) { lblMsg.Text += "."; } else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length) { lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5); } else { lblMsg.Text += "."; } })); }); //到达时间的时候执行事件; _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true); _tickTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件; HttpAdapter.optionsAsyncTo(authEndPoint + "/", new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } this.UIInvoke(() => { lblMsg.Hide(); }); _tickTimer.Enabled = false; _tickTimer = null; InitSms(); }); }
//验证 private void _LoopForAuth() { Auth_CircleThread = ThreadAdapter.UIDoCircleTask(lblMsg, () => { if (lblMsg.Text.IndexOf(".") == -1) { lblMsg.Text += "."; } else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length) { lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5); } else { lblMsg.Text += "."; } }, 200, () => { return(bStopAuthThread); },//验证未通过永远不停止 () => { return(false); }//暂时永远不跳过 ); //验证请求 HttpAdapter.optionsAsyncTo(authEndPoint + "/", new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { this.Invoke(new Action(() => { lblMsg.Hide(); // })); bStopAuthThread = true; //停止验证 if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); } else { bPassValidated = true; } }); }
private void btnOk_Click(object sender, EventArgs e) { // string authEndPoint = formatAuthEndPoint(); RemindType rt = EnumAdapter.GetEnum <RemindType>(e0571.web.core.Utils.TypeConverter.ChangeString(cbRemindType.SelectedValue)); string connectUrl = authEndPoint + "/"; HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } if (SectionWebSettingsSave != null) { SectionWebSettingsSave(this, new SectionWebSettingsSaveEventArgs { AuthEndPoint = authEndPoint }); } if (SectionBizSettingsSave != null) { SectionBizSettingsSave(this, new SectionBizSettingsSaveEventArgs { Type = rt, YYRemindFlag = (chkPlayYY.Checked ? 1 : 0) }); } this.DialogResult = DialogResult.OK; this.UIInvoke(() => { this.Close(); }); }); }