private void FillNodeItems(KeyValuePair <string, string> tree, UmbracoTreeViewItem parentItem) { parentItem.Items.Clear(); var nodes = UmbracoApplicationContext.Current.GetChildrenByType(tree.Key, parentItem.NodeId); foreach (var node in nodes) { var children = UmbracoApplicationContext.Current.GetChildrenByType(tree.Key, node.Key); var item = TreeViewHelper.CreateTreeViewItemWithImage(node.Value["Name"], "../Resources/doc2.gif", children.Any()); item.NodeId = node.Key; item.Expanded += (sender, args) => new GetNodeItemsHandler(GetNodeItems).BeginInvoke(sender, args, tree, null, null); parentItem.Items.Add(item); } }
private void FillNodeItems(KeyValuePair <string, string> tree, UmbracoTreeViewItem parentItem) { parentItem.Items.Clear(); var nodes = UmbracoApplicationContext.Current.GetChildrenByType(tree.Key, parentItem.NodeId); foreach (var node in nodes) { //Track selection to show properties per item //TrackSelection(tree.Key, node.Key); var children = UmbracoApplicationContext.Current.GetChildrenByType(tree.Key, node.Key); var item = TreeViewHelper.CreateTreeViewItemWithImage(node.Value["Name"], "../Resources/doc2.gif", children.Any()); if (tree.Key.Equals("content") || tree.Key.Equals("media")) { item.ContextMenu = new GenericMenu(new NodeMenuCommandParameters { ExplorerControl = this, NodeId = node.Key, NodeType = tree.Key, NodeTypeName = tree.Value, Name = node.Value["Name"] }, _parentWindow); } if (tree.Key.Equals("contentTypes")) { item.ContextMenu = new ContentTypeMenu(new NodeMenuCommandParameters { ExplorerControl = this, NodeId = node.Key, NodeType = tree.Key, NodeTypeName = tree.Value, Name = node.Value["Name"] }, _parentWindow); } if (tree.Key.Equals("mediaTypes")) { item.ContextMenu = new MediaTypeMenu(new NodeMenuCommandParameters { ExplorerControl = this, NodeId = node.Key, NodeType = tree.Key, NodeTypeName = tree.Value, Name = node.Value["Name"] }, _parentWindow); } if (tree.Key.Equals("dataTypes")) { item.ContextMenu = new DataTypeMenu(new NodeMenuCommandParameters { ExplorerControl = this, NodeId = node.Key, NodeType = tree.Key, NodeTypeName = tree.Value, Name = node.Value["Name"] }, _parentWindow); } item.NodeId = node.Key; item.NodeType = tree.Key; item.NodeTypeName = tree.Value; item.ToolTip = string.Format("{0}, Id: {1}", node.Value["Name"], node.Key); item.Expanded += (sender, args) => new GetNodeItemsHandler(GetNodeItems).BeginInvoke(sender, args, tree, null, null); parentItem.Items.Add(item); } }