internal Command(CommandsList parent, HierarchyNode node, string text, Action <HierarchyNode, Command> onInvoke = null, string description = null) { Parent = parent; Text = text; Description = description; if (onInvoke != null) { Commanded += (cs, ca) => { onInvoke(node, this); }; } }
public HierarchyNode() { Id = System.Threading.Interlocked.Increment(ref Counter); allItems.Add(this); Children = new NotifyingList <HierarchyNode>(); Properties = new PropertiesList(); Commands = new CommandsList(this); Children.ItemAdded += (s, a) => { a.Item.Parent = this; this.NotifyChildAdded(a.Item); }; Children.ItemRemoved += (s, a) => { this.NotifyChildRemoved(a.Item); a.Item.Parent = null; }; }