public void LoadProject() { Task.Run(() => { DataBaseFileName = Application.StartupPath + "\\IOProject\\IOCenterServer.station"; //设置数据库数据源 DbHelperSQLite.connectionString = "Data Source=" + DataBaseFileName; IO_SERVER serverBll = new IO_SERVER(); IO_COMMUNICATION commBll = new IO_COMMUNICATION(); IO_DEVICE deviceBll = new IO_DEVICE(); AddLog("初始化采集站数据......"); Servers = serverBll.GetModelList(""); AddLog("采集站数据已经完成!"); AddLog("加载通道数据......"); Communications = commBll.GetModelList(""); AddLog("通道数据已经完成!"); AddLog("加载设备及其IO点表......"); Devices = deviceBll.GetModelList(""); AddLog("加载设备及其IO点表已经完成"); for (int i = 0; i < Communications.Count; i++) { Communications[i].Devices = Devices.FindAll(x => x.IO_COMM_ID == Communications[i].IO_COMM_ID && x.IO_SERVER_ID == Communications[i].IO_SERVER_ID); } }); }
private void IOServerAdminForm_Load(object sender, EventArgs e) { IO_SERVER serverBll = new IO_SERVER(); List <Scada.Model.IO_SERVER> servers = serverBll.GetModelList(""); this.listView.Items.Clear(); for (int i = 0; i < servers.Count; i++) { ListViewItem lvi = new ListViewItem(servers[i].SERVER_ID); lvi.Tag = servers[i].SERVER_ID; lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = servers[i].SERVER_NAME }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = servers[i].SERVER_STATUS == 1 ? "在线" : "离线" }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = servers[i].SERVER_IP }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = servers[i].SERVER_CREATEDATE }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = servers[i].SERVER_REMARK }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = "删除" }); this.listView.Items.Add(lvi); } }