public void Monitour() { try { mComputerInfo = ComputerInfo.GetInstall(); this.labelComputer.Text = mComputerInfo.ComputerName; this.labelIP.Text = mComputerInfo.IP; this.labelMAC.Text = mComputerInfo.MAC; this.labelPSize.Text = decimal.Round(Convert.ToDecimal(mComputerInfo.PhysicalMemory / (1024.0d * 1024.0d * 1024.0d)), 1).ToString() + "G"; timerProcess.Start(); } catch { } }
public void InitBaseModel() { Task.Run(() => { try { DbHelperSQLite.connectionString = "Data Source=" + Application.StartupPath + "\\IOProject\\Station.station"; IO_SERVER serverBll = new IO_SERVER(); AddLogToMainLog("读取采集站信息......"); IOServer = serverBll.GetModel(ComputerInfo.GetInstall().ServerID); if (IOServer == null) { return; } mServerID = IOServer.SERVER_ID; //加载通道 AddLogToMainLog("读取采集站通道信息......"); IO_COMMUNICATION commBll = new IO_COMMUNICATION(); IOCommunications = commBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("读取采集站通道下的所有设备信息......"); IO_DEVICE deviceBll = new IO_DEVICE(); IODevices = deviceBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("数据处理中....."); for (int i = 0; i < IOCommunications.Count; i++) { AddLogToMainLog("处理 " + IOCommunications[i].IO_COMM_NAME + "[" + IOCommunications[i].IO_COMM_LABEL + "]"); IOCommunications[i].Devices = IODevices.FindAll(x => x.IO_COMM_ID == IOCommunications[i].IO_COMM_ID && x.IO_SERVER_ID == IOCommunications[i].IO_SERVER_ID); } AddLogToMainLog("正在创建驱动....."); AddLogToMainLog("读取工程完成!"); ProgressMaxNum = IOCommunications.Count + IODevices.Count; FlowGraphEngineProject.IOServer = IOServer; FlowGraphEngineProject.IOCommunications = IOCommunications; } catch (Exception ex) { ThrowExceptionToMain(ex); } }); }