public TreeNode CreateTreeNodesRecursive(TreeNode parent, IBranch branch) { return(DataVaultEditor.ThreadSafeInvoke(() => { var nodesHost = parent == null ? DataVaultEditor._tree.Nodes : parent.Nodes; var current = nodesHost[nodesHost.Add(branch.AsUIElement())]; branch.GetBranches().ForEach(b => CreateTreeNodesRecursive(current, b)); return current; })); }
public override void DoImpl() { Func<int, String> namegen = i => String.Format(Resources.New_BranchDefaultName, i); var lastUsedIndex = 1.Seq(i => i + 1, i => Branch.GetBranches().Any(b => b.Name == namegen(i))).LastOrDefault(); var unusedName = namegen(lastUsedIndex + 1); CreatedBranch = Branch.CreateBranch(unusedName).SetDefault2(); Tree.SelectedNode = Tree.Nodes[0].SelectNode(Branch.VPath); var tn = CreatedBranch.AsUIElement(); Tree.SelectedNode.Nodes.Add(tn); Tree.SelectedNode = tn; tn.BeginEdit(); }
public override void DoImpl() { Func <int, String> namegen = i => String.Format(Resources.New_BranchDefaultName, i); var lastUsedIndex = 1.Seq(i => i + 1, i => Branch.GetBranches().Any(b => b.Name == namegen(i))).LastOrDefault(); var unusedName = namegen(lastUsedIndex + 1); CreatedBranch = Branch.CreateBranch(unusedName).SetDefault2(); Tree.SelectedNode = Tree.Nodes[0].SelectNode(Branch.VPath); var tn = CreatedBranch.AsUIElement(); Tree.SelectedNode.Nodes.Add(tn); Tree.SelectedNode = tn; tn.BeginEdit(); }
public TreeNode CreateTreeNodesRecursive(TreeNode parent, IBranch branch) { return DataVaultEditor.ThreadSafeInvoke(() => { var nodesHost = parent == null ? DataVaultEditor._tree.Nodes : parent.Nodes; var current = nodesHost[nodesHost.Add(branch.AsUIElement())]; branch.GetBranches().ForEach(b => CreateTreeNodesRecursive(current, b)); return current; }); }