예제 #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;
        }
예제 #2
0
            IDictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> > strChangeRange()
            {
                var nr = _self.Upstream().Last();
                Dictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> > dic = new Dictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> >();
                var dArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Deviate, _self, OldParent, oldIndex);
                var jArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Join, _self, OldParent, oldIndex);

                if (object.Equals(PreOldRoot, nr))
                {
                    var mArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Move, _self, OldParent, oldIndex);
                    if (NewParent != null && OldParent != null && OldParent.Root() != PreOldRoot)
                    {
                        dic.Add(dArg, OldParent.Root().Levelorder());  //remove
                    }
                    dic.Add(mArg, nr.Levelorder());                    //move
                }
                else
                {
                    //add or remove
                    if (OldParent != null)
                    {
                        dic.Add(dArg, OldParent.Root().Levelorder());
                    }
                    if (NewParent != null)
                    {
                        dic.Add(jArg, NewParent.Root().Levelorder());
                    }
                    else
                    {
                        IEnumerable <TNode> v;
                        if (dic.TryGetValue(dArg, out v))
                        {
                            dic[dArg] = v.Union(_self.Levelorder());
                        }
                        else
                        {
                            dic.Add(dArg, _self.Levelorder());
                        }
                    }
                }
                return(dic);
            }
예제 #3
0
            IDictionary <ChangedDescendantInfo <TNode>, IEnumerable <TNode> > desChangedRange()
            {
                //祖先宛の子孫変更通知
                //同一ツリー内での移動
                var dic  = new Dictionary <ChangedDescendantInfo <TNode>, IEnumerable <TNode> >();
                var dArg = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Deviate, _self, OldParent, oldIndex);
                var jArg = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Join, _self, OldParent, oldIndex);

                if (object.Equals(PreOldRoot, _self.Upstream().Last()))
                {
                    var mArg    = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Move, _self, OldParent, oldIndex);
                    var deviate = preOldAnc.Except(_self.Upstream().Skip(1));
                    var join    = _self.Upstream().Skip(1).Except(preOldAnc);
                    var move    = preOldAnc.Intersect(_self.Upstream().Skip(1));
                    if (deviate.Any())
                    {
                        dic.Add(dArg, deviate);
                    }
                    if (join.Any())
                    {
                        dic.Add(jArg, join);
                    }
                    if (move.Any())
                    {
                        dic.Add(mArg, move);
                    }
                }
                else
                {
                    if (OldParent != null)
                    {
                        dic.Add(dArg, OldParent.Upstream());
                    }
                    if (NewParent != null)
                    {
                        dic.Add(jArg, NewParent.Upstream());
                    }
                }
                return(dic);
            }
예제 #4
0
 protected internal override void Undo()
 {
     NewParent.InternalReplaceItemRange(NewIndex, 1, new PlaylistItem[] { });
     OldParent.InternalReplaceItemRange(OldIndex, 0, new PlaylistItem[] { Item });
 }