private void loadDeviceListTreeView() { BindCheckBoxTreeView devicetreeview = new BindCheckBoxTreeView(); CheckBoxTreeModel treeModel = new CheckBoxTreeModel(); devicetreeview.Dt = JsonInterFace.BindTreeViewClass.DeviceTreeTable; devicetreeview.DeviceTreeViewBind(ref treeModel); UsrdomainData.Clear(); UsrdomainData.Add(treeModel); tvSpecialListDeviceTree.ItemsSource = UsrdomainData; }
public void LoadDeviceListTreeView() { new Thread(() => { BindCheckBoxTreeView devicetreeview = new BindCheckBoxTreeView(); CheckBoxTreeModel treeModel = new CheckBoxTreeModel(); devicetreeview.Dt = JsonInterFace.BindTreeViewClass.DeviceTreeTable; devicetreeview.DeviceTreeViewBind(ref treeModel); UsrdomainData.Clear(); UsrdomainData.Add(treeModel); }).Start(); }
//显示设备列表 private void LoadDeviceListTreeView() { Dispatcher.Invoke(new Action(() => { try { BindCheckBoxTreeView devicetreeview = new BindCheckBoxTreeView(); CheckBoxTreeModel treeModel = new CheckBoxTreeModel(); //过滤只显示站点 DataTable StationsTab = JsonInterFace.BindTreeViewClass.DeviceTreeTable.Clone(); StationsTab.Rows.Clear(); DataRow[] StationsRow = JsonInterFace.BindTreeViewClass.DeviceTreeTable.Select(string.Format("NodeType<>'{0}'", NodeType.LeafNode)); for (int i = 0; i < StationsRow.Length; i++) { DataRow Dr = StationsTab.NewRow(); Dr.BeginEdit(); int DrColums = StationsTab.Columns.Count; for (int j = 0; j < DrColums; j++) { Dr[j] = StationsRow[i][j]; } StationsTab.Rows.Add(Dr); Dr.EndEdit(); } devicetreeview.Dt = StationsTab; devicetreeview.DeviceTreeViewBind(ref treeModel); DeviceStartionListData.Clear(); DeviceStartionListData.Add(treeModel); DeviceListTreeView.ItemsSource = DeviceStartionListData; if (StationsTab.Rows.Count > 0) { CheckDeviceListIsChecked(); } } catch (Exception Ex) { Parameters.PrintfLogsExtended("未知设备选项显示设备表失败", Ex.Message, Ex.StackTrace); } })); }
//设备列表邦定 private void loadDeviceListTreeView() { Dispatcher.Invoke(new Action(() => { CheckBoxTreeModel treeModel = new CheckBoxTreeModel(); List <CheckBoxTreeModel> _usrdomainData = new List <CheckBoxTreeModel>(); BindCheckBoxTreeView devicetreeview = new BindCheckBoxTreeView(); DeviceListTreeView.ItemsSource = null; DeviceListTreeView.Items.Refresh(); DataRow[] dr = JsonInterFace.BindTreeViewClass.DeviceTreeTable.Copy().Select("NodeType='" + NodeType.RootNode.ToString() + "' or NodeType='" + NodeType.StructureNode.ToString() + "'"); devicetreeview.Dt = dr[0].Table.Clone(); foreach (DataRow _dr in dr) { devicetreeview.Dt.ImportRow(_dr); } devicetreeview.DeviceTreeViewBind(ref treeModel); if (treeModel.Children.Count > 0) { _usrdomainData.Add(treeModel); DeviceListTreeView.ItemsSource = _usrdomainData; } //DeviceListTreeView.ItemsSource = JsonInterFace.UsrdomainData; if (btnDelete.Tag != null) { if (btnDelete.Tag.ToString() == "Delete") { Parameters.DomainActionInfoClass.SelfID = -1; Parameters.DomainActionInfoClass.SelfName = string.Empty; Parameters.DomainActionInfoClass.NodeContent = string.Empty; Parameters.DomainActionInfoClass.ParentID = -1; Parameters.DomainActionInfoClass.PathName = string.Empty; Parameters.DomainActionInfoClass.IsDeleted = false; Parameters.DomainActionInfoClass.NodeType = string.Empty; Parameters.DomainActionInfoClass.Permission = "Enable"; Parameters.DomainActionInfoClass.NodeIcon = string.Empty; Parameters.DomainActionInfoClass.IsStation = string.Empty; btnDelete.Tag = string.Empty; } } })); }