//ui清理 private void _LoopForUiSendSms() { UiSendSms_CircleThread = ThreadAdapter.UIDoCircleTask(lb_Send, () => { if (lb_Send.Items.Count > 1000) { lb_Send.Items.Clear(); } }, 180000, () => { return(false); //暂时不停止 }, () => { return(!bPassValidated); //验证通过不跳过 }); }
//验证 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; } }); }