private void OnBeforeExpandTreeView(object sender, TreeViewCancelEventArgs e) { if (this._cancelNextTreeNodeExpandCollapse) { this._cancelNextTreeNodeExpandCollapse = false; e.Cancel = true; } else { ClassViewTreeNode node = (ClassViewTreeNode) e.Node; TreeNodeCollection nodes = node.Nodes; if ((nodes.Count == 1) && (nodes[0].GetType() == typeof(TreeNode))) { e.Cancel = true; nodes.Clear(); ProjectItemCollection childItems = node.ProjectItem.ChildItems; if ((childItems != null) && (childItems.Count != 0)) { e.Cancel = false; foreach (ProjectItem item in childItems) { ClassViewTreeNode node2 = new ClassViewTreeNode(item, item.IconIndex, true); node.Nodes.Add(node2); } } } } }
private void LoadTree(bool refresh) { try { this._treeView.BeginUpdate(); ProjectItem projectItem = this._project.ProjectItem; if (refresh) { this._treeView.Nodes.Clear(); projectItem.Refresh(); } ProjectItemCollection childItems = projectItem.ChildItems; if (childItems != null) { foreach (ProjectItem item2 in childItems) { ClassViewTreeNode node = new ClassViewTreeNode(item2, item2.IconIndex, true); this._treeView.Nodes.Add(node); } } } finally { this._treeView.EndUpdate(); } this.UpdateCommands(); }