//点击一个点 进行的树的初始化 private void initSystemTreeView() { if (building != null) { MyTreeViewItem mainNode = new MyTreeViewItem(building); mainNode.Header = createTreeViewItem(building.Name, null, false, -1, mainNode); mainNode.MouseDoubleClick += new MouseButtonEventHandler(mainNode_MouseDoubleClick); mainNode.IsExpanded = true; system_tree.Items.Add(mainNode); // globalMapFor for (int i = 0; i < building.Cabs.Count; i++) { WpfApplication2.Model.Vo.Cab cab = building.Cabs[i]; MyTreeViewItem treeNode = new MyTreeViewItem(building.Cabs[i]); treeNode.Header = createTreeViewItem(cab.Name, new BitmapImage(new Uri("/Images/rack.png", UriKind.Relative)), false, -1, treeNode); treeNode.MouseDoubleClick += cab_MouseLeftButtonDown; mainNode.Items.Add(treeNode); //显示通道 Dictionary <String, List <Device> > subSystemNames = sortSubsystem(cab); foreach (var dic in subSystemNames) { // Device device = cab.Devices[j]; MyTreeViewItem subSystemNode = new MyTreeViewItem(dic.Value); subSystemNode.Header = createTreeViewItem(dic.Key, new BitmapImage(new Uri("/Images/home8.png", UriKind.Relative)), false, -1, subSystemNode); subSystemNode.MouseDoubleClick += subSystemNode_MouseLeftButtonDown; treeNode.Items.Add(subSystemNode); } } } }
private void init() { cabListSource = new ArrayList(); selectBuildings = new List <Building>(); selectCabs = new List <Cab>(); if (_building != null) { selectBuildings.Add(_building); } if (cabs != null) { for (int i = 0; i < cabs.Count; i++) { WpfApplication2.Model.Vo.Cab cab = cabs[i]; CabUI cabUI = new CabUI(systemPage.getPageFrame(), cab); cabListSource.Add(cabUI); } } CabList.ItemsSource = cabListSource; this.Unloaded += new RoutedEventHandler(CabsPage_Unloaded); systemPage.getMainWindowInstance().c.dataChartUpdate += new Controller.DataUpdatedEventHandler(updateCabsCharts); }