private void LocateGroupByMainNode(TreeNodeGroup pTreeNodeGroup) { mListViewStorage.SetBackColorForAllItemsWith(Color.White); bool lIsSkip = false; foreach (TreeNodeGroup node in pTreeNodeGroup.Nodes) { bool isFound = false; View_GroupStorageItemRow selectedItem = node.View_GroupStorageItem; foreach (ListViewStorageItem item in mListViewStorage.Items) { //item.BackColor = Color.White; if (selectedItem.StorageItemID == item.StorageItem.ID) { isFound = true; item.BackColor = mTargetColor; if (!lIsSkip) { item.EnsureVisible(); lIsSkip = true; } } } if (!isFound) { mListViewStorage.AddNewStorageItem(selectedItem.StorageItemID, mTargetColor, true); } } }
private void mTreeViewGroup_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { mnuStripGroup.Enabled = true; // Point where the mouse is clicked. Point p = new Point(e.X, e.Y); // Get the node that the user has clicked. TreeNodeGroup node = (TreeNodeGroup)mTreeViewGroup.GetNodeAt(p); if (node != null) { mTreeViewGroup.SelectedNode = node; mnuStripGroup.Show(mTreeViewGroup, p); mnuItemRemoveGroup.Enabled = !node.IsMainNode; } else { if (mTreeViewGroup.Nodes.Count > 0) { TreeNodeGroup lastNode = (TreeNodeGroup)mTreeViewGroup.Nodes[mTreeViewGroup.Nodes.Count - 1]; mTreeViewGroup.SelectedNode = lastNode; mnuStripGroup.Show(mTreeViewGroup, lastNode.Bounds.Location); mnuItemRemoveGroup.Enabled = !node.IsMainNode; } else { mnuStripGroup.Enabled = false; } } } }
//public void LoadGroups() //{ // this.Nodes.Clear(); // View_GroupStorageItemDT view_GroupStorageItem = new View_GroupStorageItemDT(); // view_GroupStorageItem.Query.AddWhereParameter(View_GroupStorageItemDT.Parameters.StorageItemID , mStorageItem.ID); // view_GroupStorageItem.Query.AddOrderBy(View_GroupStorageItemDT.ColumnNames.StorageItemID, MyDir.ASC); // view_GroupStorageItem.Query.Load(); // foreach (View_GroupStorageItemRow view_GroupStorageItemLoop in view_GroupStorageItem.Rows) // { // AddMainGroupNodeFor(view_GroupStorageItemLoop); // } // this.ExpandAll(); //} //private void AddMainGroupNodeFor(View_GroupStorageItemRow pView_GroupStorageItemLoop) //{ // View_GroupStorageItemDT view_GroupStorageItem = new View_GroupStorageItemDT(); // view_GroupStorageItem.Query.AddWhereParameter(View_GroupStorageItemDT.Parameters.ItemGroupID , pView_GroupStorageItemLoop.ItemGroupID); // //view_GroupStorageItem.Query.AddOrderBy(View_GroupStorageItem.ColumnNames.StorageItemID, WhereParameter.Dir.ASC); // view_GroupStorageItem.Query.Load(); // TreeNodeGroup mainNode = new TreeNodeGroup(); // mainNode.View_GroupStorageItem = pView_GroupStorageItemLoop; // mainNode.Text = pView_GroupStorageItemLoop.s_GroupName; // mainNode.IsMainNode = true; // foreach (View_GroupStorageItemRow view_GroupStorageItemLoop in view_GroupStorageItem.Rows ) // { // //AddMainGroupNodeFor(view_GroupStorageItemLoop); // //AddNewNodeForView_GroupStorageItem(view_GroupStorageItemLoop); // TreeNodeGroup itemNode = GetNewItemNodeForView_GroupStorageItem(view_GroupStorageItemLoop); // mainNode.Nodes.Add(itemNode); // } // mainNode.ExpandAll(); // this.Nodes.Add(mainNode); // //AddNewNodeForView_GroupStorageItem(view_GroupStorageItemLoop); //} //public void AddNewItem(int pStorageItemID) //{ // View_GroupStorageItem view_GroupStorageItem = new View_GroupStorageItem(); // view_GroupStorageItem.Where.ListID.Value = mQList.ID; // view_GroupStorageItem.Where.StorageItemID.Value = pStorageItemID; // //view_GroupStorageItem.Query.AddOrderBy(View_ListStorageItem.ColumnNames.StorageItemID, WhereParameter.Dir.ASC); // view_GroupStorageItem.Query.Load(); // foreach (View_GroupStorageItem view_GroupStorageItemLoop in view_GroupStorageItem.AsList()) // { // AddNewNodeForView_GroupStorageItem(view_GroupStorageItemLoop); // } //} private TreeNodeGroup GetNewItemNodeForView_GroupStorageItem(View_GroupStorageItemRow pView_GroupStorageItem) { TreeNodeGroup node = new TreeNodeGroup(); node.Text = string.Format("{0}({1})", pView_GroupStorageItem.ItemName, pView_GroupStorageItem.Description); node.Tag = pView_GroupStorageItem; node.View_GroupStorageItem = pView_GroupStorageItem; node.ImageIndex = node.SelectedImageIndex = mSysIcons.GetIconIndex(pView_GroupStorageItem.GetPathIcon()); //this.Nodes.Add(node); if (pView_GroupStorageItem.StorageItemID == mStorageItem.ID) { node.BackColor = Color.Red; } return(node); }
public void RemoveSelectedNode() { if (this.SelectedNode == null) { return; } TreeNodeGroup selectedTreeNodeGroup = this.SelectedNode as TreeNodeGroup; View_GroupStorageItemRow view_GroupStorageItem = selectedTreeNodeGroup.View_GroupStorageItem; GroupStorageItemDT groupStorageItem = new GroupStorageItemDT(); groupStorageItem.Query.AddWhereParameter(GroupStorageItemDT.Parameters.GroupID, view_GroupStorageItem.ItemGroupID); groupStorageItem.Query.AddWhereParameter(GroupStorageItemDT.Parameters.StorageItemID, view_GroupStorageItem.StorageItemID); if (groupStorageItem.Query.Load()) { groupStorageItem[0].DeleteGroupStorageItem(); this.Nodes.Remove(this.SelectedNode); } }
public void LocateGroup(TreeNodeGroup pTreeNodeGroup) { if (pTreeNodeGroup == null) { return; } View_GroupStorageItemRow view_GroupStorageItem = pTreeNodeGroup.View_GroupStorageItem; if (pTreeNodeGroup.IsMainNode) { LocateGroupByMainNode(pTreeNodeGroup); } else { mListViewStorage.EnsureHasItem(view_GroupStorageItem.StorageItemID, mTargetColor, false, true); } }
private void ShowGroupControl(TreeNode node, string groupName, IUIItem[] items) { if (items.Length == 0) { return; } treeView.BeginUpdate(); TreeNode group = new TreeNodeGroup(groupName); node.Nodes.Add(group); group.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Italic); group.ForeColor = Color.Gray; foreach (IUIItem item in items) { string name = item.Name.Trim(); if (name.Length == 0) { name = "{No name}"; } ControlTreeNode itemnode = new ControlTreeNode(name); itemnode.Tag = item; foreach (string ctrlName in matchedControls.Keys) { if (CompareItem(matchedControls[ctrlName], item) == 0) { itemnode.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Bold); itemnode.ForeColor = Color.Green; itemnode.Text = itemnode.Text; itemnode.MatchedName = ctrlName; } } group.Nodes.Add(itemnode); } treeView.EndUpdate(); }
private void ShowGroupControl(TreeNode node, string groupName, IUIItem[] items) { if (items.Length == 0) return; treeView.BeginUpdate(); TreeNode group = new TreeNodeGroup(groupName); node.Nodes.Add(group); group.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Italic); group.ForeColor = Color.Gray; foreach (IUIItem item in items) { string name = item.Name.Trim(); if (name.Length == 0) name = "{No name}"; ControlTreeNode itemnode = new ControlTreeNode(name); itemnode.Tag = item; foreach (string ctrlName in matchedControls.Keys) { if (CompareItem(matchedControls[ctrlName], item) == 0) { itemnode.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Bold); itemnode.ForeColor = Color.Green; itemnode.Text = itemnode.Text; itemnode.MatchedName = ctrlName; } } group.Nodes.Add(itemnode); } treeView.EndUpdate(); }
public TreeNode() { TreeChildren = new TreeNodeGroup(); Background = Brushes.Transparent; }
internal void ClearParent() { TreeChildren = new TreeNodeGroup(); }
public TreeNodeDrawer(int width = 55, int height = 28) { NodeSize = new System.Drawing.Size(width, height); TreeChildren = new TreeNodeGroup(); }
public TreeCanvasNode() { TreeChildren = new TreeNodeGroup(); Background = Brushes.Transparent; }
private void LoadModel() { // Store Selected EsriTable (if any) EsriTable table = null; if (this.treeView1.SelectedNode != null) { TreeNodeTable treeNodeTable = this.treeView1.SelectedNode as TreeNodeTable; if (treeNodeTable != null) { if (treeNodeTable.Table != null) { table = treeNodeTable.Table; } } } // Clear TreeView this.treeView1.Nodes.Clear(); // Exit if No Model if (this._model == null) { return; } // Get Datasets List <Dataset> datasets = this._model.GetDatasets(); // Get Domains List <Domain> domains = this._model.GetDomains(); // Start TreeView Update this.treeView1.BeginUpdate(); this.treeView1.Sorted = false; // Add Geodatabase Node TreeNodeGeodatabase treeNode = new TreeNodeGeodatabase(this._model); treeNode.ImageKey = Catalog.GEODATABASE; treeNode.SelectedImageKey = Catalog.GEODATABASE; treeNode.Text = this._model.Title; this.treeView1.Nodes.Add(treeNode); if (this.buttonItemCatalog.Checked) { // Sort Datasets datasets.Sort(); // Loop Throught Datasets foreach (Dataset dataset in datasets) { if (dataset is FeatureDataset) { // Get FeatureDataset FeatureDataset featureDataset = (FeatureDataset)dataset; // Add FeatureDataset Node TreeNode treeNode2 = this.CreateCatalogNode(treeNode, featureDataset); // Get Child Datasets List <Dataset> datasets2 = featureDataset.GetChildren(); datasets2.Sort(); foreach (Dataset dataset2 in datasets2) { TreeNode treeNode3 = this.CreateCatalogNode(treeNode2, dataset2); // Add Subtypes if ObjectClass if (dataset2 is ObjectClass) { // Get ObjectClass ObjectClass objectClass = (ObjectClass)dataset2; // Get Subtypes List <Subtype> subtypes = objectClass.GetSubtypes(); subtypes.Sort(); // Add Subtypes Nodes foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode3, subtype); } } } } } // Add Everything Else foreach (Dataset dataset in datasets) { // Skip FeatureDataset and FeatureDataset Objects if (dataset is FeatureDataset || dataset is GeometricNetwork || dataset is Network || dataset is RasterBand || dataset is Terrain || dataset is Topology) { continue; } // Skip Objects that Belong to a FeatureDataset if (dataset is FeatureClass || dataset is RelationshipClass) { Dataset parent = dataset.GetParent(); if (parent != null) { continue; } } // Create Node TreeNode treeNode2 = this.CreateCatalogNode(treeNode, dataset); // Add Subtypes if ObjectClass if (dataset is ObjectClass) { // Get ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get Subtypes List <Subtype> subtypes = objectClass.GetSubtypes(); subtypes.Sort(); // Add Subtypes Nodes foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode2, subtype); } } // Add Raster Bands if (dataset.GetType() == typeof(RasterDataset)) { // Get RasterDataset RasterDataset rasterDataset = (RasterDataset)dataset; // Get RasterBands List <Dataset> rasterBands = rasterDataset.GetChildren(); // Add RasterBands foreach (Dataset datasetRasterBand in rasterBands) { if (datasetRasterBand.GetType() == typeof(RasterBand)) { RasterBand rasterBand = (RasterBand)datasetRasterBand; TreeNode treeNodeRasterBand = this.CreateCatalogNode(treeNode2, rasterBand); } } } } // Sort Domains domains.Sort(); // Add Domains foreach (Domain domain in domains) { TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain); } // Expand Geodatabase Node treeNode.Expand(); } else if (this.buttonItemCategorized.Checked) { // Loop for each Dataset foreach (Dataset dataset in datasets) { // Get Group Node Name string key = string.Empty; if (dataset.GetType() == typeof(FeatureDataset)) { key = Resources.TEXT_FEATURE_DATASET; } else if (dataset.GetType() == typeof(FeatureClass)) { key = Resources.TEXT_FEATURE_CLASS; } else if (dataset.GetType() == typeof(GeometricNetwork)) { key = Resources.TEXT_GEOMETRIC_NETWORK; } else if (dataset.GetType() == typeof(ObjectClass)) { key = Resources.TEXT_TABLE; } else if (dataset.GetType() == typeof(RasterBand)) { key = Resources.TEXT_RASTER_BAND; } else if (dataset.GetType() == typeof(RasterCatalog)) { key = Resources.TEXT_RASTER_CATALOG; } else if (dataset.GetType() == typeof(RasterDataset)) { key = Resources.TEXT_RASTER_DATASET; } else if (dataset.GetType() == typeof(RelationshipClass)) { key = Resources.TEXT_RELATIONSHIP; } else if (dataset.GetType() == typeof(Terrain)) { key = Resources.TEXT_TERRAIN; } else if (dataset.GetType() == typeof(Topology)) { key = Resources.TEXT_TOPOLOGY; } if (string.IsNullOrEmpty(key)) { continue; } // Get Group Node (create if it does not exist) TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == dataset.GetType()) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(dataset.GetType()); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = key; treeNode.Nodes.Add(treeNodeGroup); } // Create New Dataset Node TreeNode treeNodeDataset = this.CreateCatalogNode(treeNodeGroup, dataset); } // Append Subtypes Nodes foreach (Dataset dataset in datasets) { // Is ObjectClass? if (dataset is ObjectClass) { // Cast to ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get Subtypes List <Subtype> subtypes = objectClass.GetSubtypes(); if (subtypes.Count == 0) { continue; } // Find Subtype Group Node TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == typeof(Subtype)) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(typeof(Subtype)); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = Resources.TEXT_SUBTYPE; treeNode.Nodes.Add(treeNodeGroup); } // Add Each Subtype foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNodeGroup, subtype); } } } // Loop for each Domain foreach (Domain domain in domains) { // Get Group Node Name string key = string.Empty; if (domain.GetType() == typeof(DomainCodedValue)) { key = Resources.TEXT_CODED_VALUE; } else if (domain.GetType() == typeof(DomainRange)) { key = Resources.TEXT_RANGE_DOMAIN; } if (string.IsNullOrEmpty(key)) { continue; } // Get Group Node (create if it does not exist) TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == domain.GetType()) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(domain.GetType()); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = key; treeNode.Nodes.Add(treeNodeGroup); } // Create New Dataset Node TreeNode treeNodeDomain = this.CreateCatalogNode(treeNodeGroup, domain); } // Expand Geodatabase Node treeNode.Expand(); // Traditional Text Sort this.treeView1.Sort(); } else if (this.buttonItemAlphabetical.Checked) { // Loop for each Dataset foreach (Dataset dataset in datasets) { // Create New Dataset Node TreeNode treeNodeDataset = this.CreateCatalogNode(treeNode, dataset); if (dataset is ObjectClass) { // Cast to ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get and Add Subtypes List <Subtype> subtypes = objectClass.GetSubtypes(); foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode, subtype); } } } // Loop for each Domain foreach (Domain domain in domains) { TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain); } // Expand Geodatabase Node treeNode.Expand(); // Traditional Text Sort this.treeView1.Sort(); } // Reselect Previous EsriTable (if any) if (table != null) { if (this.treeView1.Nodes.Count == 1) { //TreeNode treeNode = this.treeView1.Nodes[0]; TreeNode treeNodeFind = this.FindNode(treeNode, table); if (treeNodeFind != null) { treeNodeFind.EnsureVisible(); treeNodeFind.TreeView.SelectedNode = treeNodeFind; } } } // End TreeView Update this.treeView1.EndUpdate(); }
private void LoadModel() { // Store Selected EsriTable (if any) EsriTable table = null; if (this.treeView1.SelectedNode != null) { TreeNodeTable treeNodeTable = this.treeView1.SelectedNode as TreeNodeTable; if (treeNodeTable != null) { if (treeNodeTable.Table != null) { table = treeNodeTable.Table; } } } // Clear TreeView this.treeView1.Nodes.Clear(); // Exit if No Model if (this._model == null) { return; } // Get Datasets List<Dataset> datasets = this._model.GetDatasets(); // Get Domains List<Domain> domains = this._model.GetDomains(); // Start TreeView Update this.treeView1.BeginUpdate(); this.treeView1.Sorted = false; // Add Geodatabase Node TreeNodeGeodatabase treeNode = new TreeNodeGeodatabase(this._model); treeNode.ImageKey = Catalog.GEODATABASE; treeNode.SelectedImageKey = Catalog.GEODATABASE; treeNode.Text = this._model.Title; this.treeView1.Nodes.Add(treeNode); if (this.buttonItemCatalog.Checked) { // Sort Datasets datasets.Sort(); // Loop Throught Datasets foreach (Dataset dataset in datasets) { if (dataset is FeatureDataset) { // Get FeatureDataset FeatureDataset featureDataset = (FeatureDataset)dataset; // Add FeatureDataset Node TreeNode treeNode2 = this.CreateCatalogNode(treeNode, featureDataset); // Get Child Datasets List<Dataset> datasets2 = featureDataset.GetChildren(); datasets2.Sort(); foreach (Dataset dataset2 in datasets2) { TreeNode treeNode3 = this.CreateCatalogNode(treeNode2, dataset2); // Add Subtypes if ObjectClass if (dataset2 is ObjectClass) { // Get ObjectClass ObjectClass objectClass = (ObjectClass)dataset2; // Get Subtypes List<Subtype> subtypes = objectClass.GetSubtypes(); subtypes.Sort(); // Add Subtypes Nodes foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode3, subtype); } } } } } // Add Everything Else foreach (Dataset dataset in datasets) { // Skip FeatureDataset and FeatureDataset Objects if (dataset is FeatureDataset || dataset is GeometricNetwork || dataset is Network || dataset is RasterBand || dataset is Terrain || dataset is Topology) { continue; } // Skip Objects that Belong to a FeatureDataset if (dataset is FeatureClass || dataset is RelationshipClass) { Dataset parent = dataset.GetParent(); if (parent != null) { continue; } } // Create Node TreeNode treeNode2 = this.CreateCatalogNode(treeNode, dataset); // Add Subtypes if ObjectClass if (dataset is ObjectClass) { // Get ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get Subtypes List<Subtype> subtypes = objectClass.GetSubtypes(); subtypes.Sort(); // Add Subtypes Nodes foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode2, subtype); } } // Add Raster Bands if (dataset.GetType() == typeof(RasterDataset)) { // Get RasterDataset RasterDataset rasterDataset = (RasterDataset)dataset; // Get RasterBands List<Dataset> rasterBands = rasterDataset.GetChildren(); // Add RasterBands foreach (Dataset datasetRasterBand in rasterBands) { if (datasetRasterBand.GetType() == typeof(RasterBand)) { RasterBand rasterBand = (RasterBand)datasetRasterBand; TreeNode treeNodeRasterBand = this.CreateCatalogNode(treeNode2, rasterBand); } } } } // Sort Domains domains.Sort(); // Add Domains foreach (Domain domain in domains) { TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain); } // Expand Geodatabase Node treeNode.Expand(); } else if (this.buttonItemCategorized.Checked) { // Loop for each Dataset foreach (Dataset dataset in datasets) { // Get Group Node Name string key = string.Empty; if (dataset.GetType() == typeof(FeatureDataset)) { key = Resources.TEXT_FEATURE_DATASET; } else if (dataset.GetType() == typeof(FeatureClass)) { key = Resources.TEXT_FEATURE_CLASS; } else if (dataset.GetType() == typeof(GeometricNetwork)) { key = Resources.TEXT_GEOMETRIC_NETWORK; } else if (dataset.GetType() == typeof(ObjectClass)) { key = Resources.TEXT_TABLE; } else if (dataset.GetType() == typeof(RasterBand)) { key = Resources.TEXT_RASTER_BAND; } else if (dataset.GetType() == typeof(RasterCatalog)) { key = Resources.TEXT_RASTER_CATALOG; } else if (dataset.GetType() == typeof(RasterDataset)) { key = Resources.TEXT_RASTER_DATASET; } else if (dataset.GetType() == typeof(RelationshipClass)) { key = Resources.TEXT_RELATIONSHIP; } else if (dataset.GetType() == typeof(Terrain)) { key = Resources.TEXT_TERRAIN; } else if (dataset.GetType() == typeof(Topology)) { key = Resources.TEXT_TOPOLOGY; } if (string.IsNullOrEmpty(key)) { continue; } // Get Group Node (create if it does not exist) TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == dataset.GetType()) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(dataset.GetType()); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = key; treeNode.Nodes.Add(treeNodeGroup); } // Create New Dataset Node TreeNode treeNodeDataset = this.CreateCatalogNode(treeNodeGroup, dataset); } // Append Subtypes Nodes foreach (Dataset dataset in datasets) { // Is ObjectClass? if (dataset is ObjectClass) { // Cast to ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get Subtypes List<Subtype> subtypes = objectClass.GetSubtypes(); if (subtypes.Count == 0) { continue; } // Find Subtype Group Node TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == typeof(Subtype)) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(typeof(Subtype)); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = Resources.TEXT_SUBTYPE; treeNode.Nodes.Add(treeNodeGroup); } // Add Each Subtype foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNodeGroup, subtype); } } } // Loop for each Domain foreach (Domain domain in domains) { // Get Group Node Name string key = string.Empty; if (domain.GetType() == typeof(DomainCodedValue)) { key = Resources.TEXT_CODED_VALUE; } else if (domain.GetType() == typeof(DomainRange)) { key = Resources.TEXT_RANGE_DOMAIN; } if (string.IsNullOrEmpty(key)) { continue; } // Get Group Node (create if it does not exist) TreeNodeGroup treeNodeGroup = null; foreach (TreeNodeGroup group in treeNode.Nodes) { if (group.Type == domain.GetType()) { treeNodeGroup = group; break; } } if (treeNodeGroup == null) { treeNodeGroup = new TreeNodeGroup(domain.GetType()); treeNodeGroup.ImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED; treeNodeGroup.Text = key; treeNode.Nodes.Add(treeNodeGroup); } // Create New Dataset Node TreeNode treeNodeDomain = this.CreateCatalogNode(treeNodeGroup, domain); } // Expand Geodatabase Node treeNode.Expand(); // Traditional Text Sort this.treeView1.Sort(); } else if (this.buttonItemAlphabetical.Checked) { // Loop for each Dataset foreach (Dataset dataset in datasets) { // Create New Dataset Node TreeNode treeNodeDataset = this.CreateCatalogNode(treeNode, dataset); if (dataset is ObjectClass) { // Cast to ObjectClass ObjectClass objectClass = (ObjectClass)dataset; // Get and Add Subtypes List<Subtype> subtypes = objectClass.GetSubtypes(); foreach (Subtype subtype in subtypes) { TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode, subtype); } } } // Loop for each Domain foreach (Domain domain in domains) { TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain); } // Expand Geodatabase Node treeNode.Expand(); // Traditional Text Sort this.treeView1.Sort(); } // Reselect Previous EsriTable (if any) if (table != null) { if (this.treeView1.Nodes.Count == 1) { //TreeNode treeNode = this.treeView1.Nodes[0]; TreeNode treeNodeFind = this.FindNode(treeNode, table); if (treeNodeFind != null) { treeNodeFind.EnsureVisible(); treeNodeFind.TreeView.SelectedNode = treeNodeFind; } } } // End TreeView Update this.treeView1.EndUpdate(); }