/// <summary>
        /// 粘贴节点并自动更新相关的内存及数据库中的记录
        /// 要求被剪切的节点必须是“独立”的(其Parent属性==null)
        /// </summary>
        /// <param name="nodeToBeCut">被剪切的节点</param>
        /// <param name="attachToNode">将接收被剪切节点的那个节点</param>
        public void PasteNode(TreeViewIconsItem nodeToBeCut, TreeViewIconsItem attachToNode)
        {
            if (nodeToBeCut == null || attachToNode == null || nodeToBeCut.Parent != null)
            {
                return;
            }
            String oldPath = nodeToBeCut.Path;
            String newPath = attachToNode.Path + nodeToBeCut.HeaderText + "/";
            tree.BeginInit();
            attachToNode.Items.Add(nodeToBeCut);

            //更新所有内存相关子节点集合的路径
            nodesManager.UpdateNodePath(oldPath, newPath);
            //更新数据库中相关子节点的路径
            NodePathManager.UpdateNodePath(oldPath, newPath);

            tree.EndInit();
            //激发事件
            if (NodeMove != null)
            {
                NodeMoveEventArgs e = new NodeMoveEventArgs
                {
                    MoveType = NodeMoveType.NodePaste,
                    Node = nodeToBeCut,
                    PrevPath = oldPath
                };
                NodeMove(nodeToBeCut, e);
            }
        }
        /// <summary>
        /// 左移(即升级)
        /// 1.已是顶级节点则不动
        /// 2.成为父节点的兄弟
        /// </summary>
        /// <param name="node"></param>
        public void MoveLeft(TreeViewIconsItem node)
        {
            if (node == null)
            {
                return;
            }
            //己经是顶级节点
            if (IsFirstLevelNode(node))
            {
                return;
            }
            //记录下当前路径
            String oldPath = node.Path;
            //查找父节点
            TreeViewIconsItem parent = GetParent(node) as TreeViewIconsItem;
            int parentIndex = GetNodeIndex(parent);
            //查找爷爷节点
            ItemsControl grandfather = GetParent(parent);
            String newPath="";
            //获取新路径
            if (grandfather == tree)
            {
                newPath = "/" + node.HeaderText + "/";
            }
            else
            {
                newPath = (grandfather as TreeViewIconsItem).Path + node.HeaderText + "/";
            }
            if (IsNodeExisted(newPath))
            {
                MessageBox.Show("己经存在相同路径的节点,不允许升级");
                return;
            }
            tree.BeginInit();
            //先移除自己
            parent.Items.Remove(node);
            //插入成为父亲的兄弟节点
            grandfather.Items.Insert(parentIndex + 1, node);

            node.Path=newPath;
            node.NodeData.DataItem.Path = newPath;
            //更新所有内存相关子节点集合的路径
            nodesManager.UpdateNodePath(oldPath, newPath);
            //更新数据库中相关子节点的路径
            NodePathManager.UpdateNodePath(oldPath, newPath);

            node.IsSelected = true;

            tree.EndInit();
            //激发事件
            if (NodeMove != null)
            {
                NodeMoveEventArgs e = new NodeMoveEventArgs
                {
                    MoveType = NodeMoveType.NodeMoveLeft,
                    Node = node,
                    PrevPath=oldPath
                };
                NodeMove(node, e);
            }
        }
        /// <summary>
        /// 右移(即降级)
        /// 1.无兄弟节点则不动
        /// 2.如有兄弟节点,则成为上一个兄弟节点的子节点
        /// 3.如果本身是所有兄弟节点中的第一个,则成为下一个兄弟的子节点
        /// </summary>
        /// <param name="node"></param>
        public void MoveRight(TreeViewIconsItem node)
        {
            if (node == null)
            {
                return;
            }
            //记录下当前路径
            String oldPath = node.Path;

            ItemsControl parent = GetParent(node);
            //查找兄弟节点
            TreeViewIconsItem prevBrother = GetPrevNode(node);
            TreeViewIconsItem nextBrother = GetNextNode(node);
            //是独子
            if (prevBrother == null && nextBrother == null)
            {
                return;
            }
            //获取新路径
            String newPath = "";

            if (prevBrother != null)
            {

                newPath = prevBrother.Path + node.HeaderText + "/";

            }
            else
            {

                newPath = nextBrother.Path + node.HeaderText + "/";

            }
            if (IsNodeExisted(newPath))
            {
                MessageBox.Show("已经存在相同路径的节点,不允许降级。");
                return;
            }

            tree.BeginInit();
            //删除自己
            parent.Items.Remove(node);
            //插入
            if (prevBrother != null)
            {
                prevBrother.Items.Add(node);
                node.Path = newPath;
                node.NodeData.DataItem.Path = newPath;
                prevBrother.IsExpanded = true;
            }
            else
            {
                nextBrother.Items.Add(node);
                node.Path = newPath;
                node.NodeData.DataItem.Path = newPath;
                nextBrother.IsExpanded = true;
            }

            //更新所有内存相关子节点集合的路径
            nodesManager.UpdateNodePath(oldPath, newPath);
            //更新数据库中相关子节点的路径
            NodePathManager.UpdateNodePath(oldPath, newPath);

            node.IsSelected = true;
            tree.EndInit();
            //激发事件
            if (NodeMove != null)
            {
                NodeMoveEventArgs e = new NodeMoveEventArgs
                {
                    MoveType = NodeMoveType.NodeMoveRight,
                    Node = node,
                    PrevPath = oldPath
                };
                NodeMove(node, e);
            }
        }
        /// <summary>
        /// 粘贴节点并自动更新相关的内存,IsCrossDB表明是否是跨数据库粘贴
        /// </summary>
        /// <param name="nodeToBeCut"></param>
        /// <param name="attachToNode"></param>
        /// <param name="IsCrossDB">IsCrossDB表明是否是跨数据库粘贴</param>
        private void PasteNode(TreeViewIconsItem nodeToBeCut, TreeViewIconsItem attachToNode, bool IsCrossDB)
        {
            if (nodeToBeCut == null || nodeToBeCut.Parent != null)
            {
                return;
            }
            ShouldRaiseSelectedItemChangedEvent = true;
            String oldPath = nodeToBeCut.Path;
            String newPath = "";
            //如果attachToNode为null,则将在根节点添加子树
            if (attachToNode == null)
            {
                //newPath = "/" + nodeToBeCut.HeaderText + "/";
                newPath = "/";
            }
            else
            {
                //当前己经选中了节点,被粘贴的节点成为其子树
                newPath = attachToNode.Path + nodeToBeCut.HeaderText + "/";
            }

            tree.BeginInit();

            if (!IsCrossDB)
            {
                if (attachToNode != null)
                {
                    //被粘贴的节点成为当前选中节点的子树
                    attachToNode.Items.Add(nodeToBeCut);
                }
                else
                {
                    //在顶层放置被粘贴的节点
                    tree.Items.Add(nodeToBeCut);
                }

                //更新所有内存相关子节点集合的路径
                nodesManager.UpdateNodePath(oldPath, newPath);
                if (_nodePathManager != null)
                {
                    //更新数据库中相关子节点的路径
                    _nodePathManager.UpdateNodePath(oldPath, newPath);
                }

                tree.EndInit();
                //激发事件
                if (NodeMove != null)
                {
                    NodeMoveEventArgs e = new NodeMoveEventArgs
                    {
                        MoveType = NodeMoveType.NodePaste,
                        Node = nodeToBeCut,
                        PrevPath = oldPath
                    };
                    NodeMove(nodeToBeCut, e);
                }
            }
            else
            {
                //跨数据库的粘贴

                if (attachToNode != null)
                {
                    //被粘贴的节点成为当前选中节点的子树
                    attachToNode.Items.Add(nodeToBeCut);
                    updateChildNodePath(attachToNode.Path, nodeToBeCut);
                }
                else
                {
                    //在顶层放置被粘贴的节点
                    tree.Items.Add(nodeToBeCut);
                    updateChildNodePath("/", nodeToBeCut);
                }

                tree.EndInit();

            }
        }