public MainForm() { InitializeComponent(); LoadAllTrivets(); LoadAllCompanies(); LoadAllData(); TCPClass TCP = new TCPClass(); TCP.TCPConnection(); //txtConnectionString.Text = SetUpClass._dbcon; // cbTemplateLanguage.Items.Clear(); // cbSituation.Items.Clear(); // cbLanguageCode.Items.Clear(); }
public event EventHandler WashingFormulaEnd; //完成事件 #endregion public void Excute() { DS_PotDAL potDAL = new DS_PotDAL(); potList = potDAL.GetPotListByType(3);//获取所有缸信息 DS_DeviceDAL deviceDAL = new DS_DeviceDAL(); deviceList = deviceDAL.GetList(3); tcpclass = new TCPClass(); tcpclass.Receive_Event += Receive_Event; tcpclass.Error_Event += Error_Event; Task.Factory.StartNew(() => //线程执行任务 { while (true) { if (Golbal.CurrentFormulaModel != null) { tcpclass.SendString(IPAddress.Parse(Golbal.CurrentFormulaModel.ClientIP), GetActionInfo()); } Thread.Sleep(1000); } }); Task.Factory.StartNew(() => //线程执行任务 { while (true) { foreach (DS_DeviceModel devicemodel in deviceList) { string washstr = WashingGetActionInfo(devicemodel.Id); tcpclass.SendString(IPAddress.Parse(devicemodel.IP), washstr); Thread.Sleep(1000); } } }); }