private void tvDatasets_AfterSelect(object sender, TreeViewEventArgs e) { DatasetTreeNode dsTreeNode = tvDatasets.SelectedNode as DatasetTreeNode; if (dsTreeNode != null) { datasetInfoControl1.Dataset = dsTreeNode.Dataset; datasetInfoControl1.Visible = true; btnRemoveDataset.Enabled = true; } else { datasetInfoControl1.Visible = false; btnRemoveDataset.Enabled = false; } }
private void InitUI() { tvDatasets.Nodes.Clear(); MapTreeNode root = new MapTreeNode() { Map = _map }; int i = 0; IDataset dataset = null; while ((dataset = _map[i++]) != null) { int count = (from l in _map.MapElements where l.DatasetID == (i - 1) select l).Count(); var datasetNode = new DatasetTreeNode() { Dataset = dataset, LayerCount = count }; root.Nodes.Add(datasetNode); if (btnRemoveUnusedDatasets.Enabled == false) { btnRemoveUnusedDatasets.Enabled = count == 0; } if (count > 0) { foreach (var layer in _map.MapElements.Where(l => l.DatasetID == i - 1)) { datasetNode.Nodes.Add(new LayerTreeNode(layer)); } } } tvDatasets.Nodes.Add(root); root.Expand(); }