public TagonomyNodeViewItem PreCreateView(PathNodeElement.Leg leg, TagonomyNode node) { var view = new TagonomyNodeViewItem(node); view.Leg = leg; var tagonomy = this.Source; if (leg == null || leg.Type != PathNodeElement.Leg.Types.Shortcut) // Shortcuts show no children. { foreach (var childNodeLeg in node.GetDirectChildrenLegs()) { var childNode = tagonomy.GetNode(childNodeLeg.TargetNodeId); if (childNode == null) { continue; } TagonomyNodeViewItem childView = PreCreateView(childNodeLeg, childNode); view.AddChild(childView); } } return(view); }
public TagonomyNodeViewItem(TagonomyNode node) { this.Children = new ObservableCollection <TagonomyNodeViewItem>(); this.Children.CollectionChanged += Children_CollectionChanged; this.Node = node; node.PropertyChanged += node_PropertyChanged; }
void CreateNode(bool isShortcut, string name) { var node = new TagonomyNode() { Name = "{New Node}" }; if (string.IsNullOrEmpty(name) == false) { node.Name = CreatedTagonomyNodeName; } if (this.Mode == Modes.Limited_User) { node.Type = TagonomyNode.NodeTypes.User; } if (Source != null) { node.TagonomyId = Source.Id; } if (SelectedItem != null) { var pathId = SelectedItem.Node.ElementsArray.Where(it => it is PathNodeElement).Select(it => it.Id).LastOrDefault(); // Get the Id of the last Path Element. var leg = SelectedItem.Node.AddChildNode(pathId, node.Id, isShortcut ? PathNodeElement.Leg.Types.Shortcut : PathNodeElement.Leg.Types.Default); } if (Source != null) { Source.AddNode(node); } RefreshNavigation(); }