//结束任务 public void TaskStop() { if (TaskState) { threadNewTask.Stop(); threadUpadteTask.Stop(); threadAssignTask.Stop(); DataSync.Stop(); } }
//结束同步 public static void Stop() { if (SyncState.Dbus) { dbusThread.Stop(); } if (SyncState.ModbusTcp) { modbusThread.Stop(); } }
private void MDIParent1_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show("真的要退出程序吗?", "退出程序", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { e.Cancel = true; } else { ConsoleThread.Stop(); if (UdpSever.State)//如果服务器运行,则关闭服务器 { UdpSever.Stop(); } //关闭任务调度线程 taskForm.TaskStop(); } }
private void DataMonitor_FormClosing(object sender, FormClosingEventArgs e) { mainThread.Stop(); }