コード例 #1
0
ファイル: FolderNode.cs プロジェクト: shijiong/ntvsiot
        /// <summary>
        /// Moves the HierarchyNode from the old path to be a child of the
        /// newly specified node.
        ///
        /// This is a low-level operation that only updates the hierarchy and our MSBuild
        /// state.  The parents of the node must already be created.
        ///
        /// To do a general rename, call RenameFolder instead.
        /// </summary>
        internal void ReparentFolder(string newPath)
        {
            // Reparent the folder
            ProjectMgr.OnItemDeleted(this);
            Parent.RemoveChild(this);
            ID = ProjectMgr.ItemIdMap.Add(this);

            ItemNode.Rename(CommonUtils.GetRelativeDirectoryPath(ProjectMgr.ProjectHome, newPath));
            var parent = ProjectMgr.GetParentFolderForPath(newPath);

            Debug.Assert(parent != null, "ReparentFolder called without full path to parent being created");
            parent.AddChild(this);
        }
コード例 #2
0
        /// <summary>
        /// Moves the HierarchyNode from the old path to be a child of the
        /// newly specified node.
        ///
        /// This is a low-level operation that only updates the hierarchy and our MSBuild
        /// state.  The parents of the node must already be created.
        ///
        /// To do a general rename, call RenameFolder instead.
        /// </summary>
        internal void ReparentFolder(string newPath)
        {
            // Reparent the folder
            ProjectMgr.OnItemDeleted(this);
            Parent.RemoveChild(this);
            ProjectMgr.Site.GetUIThread().MustBeCalledFromUIThread();
            ID = ProjectMgr.ItemIdMap.Add(this);

            ItemNode.Rename(CommonUtils.GetRelativeDirectoryPath(ProjectMgr.ProjectHome, newPath));
            var parent = ProjectMgr.GetParentFolderForPath(newPath);

            if (parent == null)
            {
                Debug.Fail("ReparentFolder called without full path to parent being created");
                throw new DirectoryNotFoundException(newPath);
            }
            parent.AddChild(this);
        }