Exemple #1
0
        public override void UndoImpl()
        {
            var draggedNode = Tree.Nodes[0].SelectNode(DraggedBranch.VPath);

            draggedNode.Text = OldName;

            DraggedBranch.Delete();
            DraggedBranch.Rename(OldName);
            OldParent.AttachBranch(DraggedBranch);

            var oldParentNode = Tree.Nodes[0].SelectNode(OldParent.VPath);

            draggedNode.Remove();
            oldParentNode.Nodes.Add(draggedNode);
            Tree.SelectedNode = draggedNode;
        }
Exemple #2
0
        public override void DoImpl()
        {
            var draggedNode = Tree.Nodes[0].SelectNode(DraggedBranch.VPath);

            OldParent = DraggedBranch.Parent;
            OldName   = DraggedBranch.Name;

            Func <int, String> namegen = i => i == 1 ? DraggedBranch.Name : String.Format(
                Resources.New_BranchDefaultPastedName, DraggedBranch.Name, i - 1);
            var lastUsedIndex = 1.Seq(i => i + 1, i => Branch.GetBranches().Any(b => b.Name == namegen(i))).LastOrDefault();

            DraggedBranch.Rename(namegen(lastUsedIndex + 1));
            draggedNode.Text = DraggedBranch.Name;

            DraggedBranch.Delete();
            Branch.AttachBranch(DraggedBranch);

            draggedNode.Remove();
            Tree.SelectedNode = Tree.Nodes[0].SelectNode(Branch.VPath);
            Tree.SelectedNode.Nodes.Add(draggedNode);
            Tree.SelectedNode = draggedNode;
        }