private void Btn_Exit_Click(object sender, EventArgs e) { if (thread != null) { this.HisScanSta = ScanSta.Stop; thread.Abort(); } this.Close(); }
/// <summary> /// 执行线程. /// </summary> public void RunIt() { HisScanSta = ScanSta.Working; while (true) { System.Threading.Thread.Sleep(20000); while (this.HisScanSta == ScanSta.Pause) { System.Threading.Thread.Sleep(3000); Console.Beep(); } this.SetText("*** 开始执行:"); this.RunFlow("024", "zhanghaicheng", 1000000000); System.Threading.Thread.Sleep(1000); switch (this.toolStripStatusLabel1.Text) { case "服务启动": this.toolStripStatusLabel1.Text = "服务启动.."; break; case "服务启动..": this.toolStripStatusLabel1.Text = "服务启动........"; break; case "服务启动....": this.toolStripStatusLabel1.Text = "服务启动............."; break; default: this.toolStripStatusLabel1.Text = "服务启动"; break; } } }
/// <summary> /// 执行线程. /// </summary> public void RunIt() { BP.WF.Flows fls = new BP.WF.Flows(); fls.RetrieveAll(); HisScanSta = ScanSta.Working; while (true) { System.Threading.Thread.Sleep(20000); while (this.HisScanSta == ScanSta.Pause) { System.Threading.Thread.Sleep(3000); if (this.checkBox1.Checked) { Console.Beep(); } } this.SetText("********************************"); this.SetText("扫描触发式自动发起流程表......"); this.DoTask(); this.SetText("扫描定时发起流程...."); this.DoAutuFlows(fls); this.SetText("扫描消息表...."); this.DoSendMsg(); //this.SetText("向CCIM里发送消息..."); //this.DoSendMsgOfCCIM(); if (DateTime.Now.Hour < 18 && DateTime.Now.Hour > 8) { /* 在工作时间段才可以执行此调度。 */ string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); if (now.Contains(":13") || now.Contains(":33") || now.Contains(":53")) { this.SetText("检索自动节点任务...."); this.DoAutoNode(); } } System.Threading.Thread.Sleep(1000); switch (this.toolStripStatusLabel1.Text) { case "服务启动": this.toolStripStatusLabel1.Text = "服务启动.."; break; case "服务启动..": this.toolStripStatusLabel1.Text = "服务启动........"; break; case "服务启动....": this.toolStripStatusLabel1.Text = "服务启动............."; break; default: this.toolStripStatusLabel1.Text = "服务启动"; break; } } }