Microsoft.VisualStudio.Project.NestedProjectNode.CloseNestedProjectNode C# (CSharp) Method

CloseNestedProjectNode() public method

Closes a nested project and releases the nested hierarchy pointer.
public CloseNestedProjectNode ( ) : void
return void
        public virtual void CloseNestedProjectNode()
        {
            if (this.isDisposed || this.ProjectManager == null || this.ProjectManager.IsClosed)
            {
                return;
            }

            uint itemid = VSConstants.VSITEMID_NIL;
            try
            {
                this.DisconnectPropertyNotifySink();

                IVsUIHierarchy hier;

                IVsWindowFrame windowFrame;
                VsShellUtilities.IsDocumentOpen(this.ProjectManager.Site, this.ProjectPath, Guid.Empty, out hier, out itemid, out windowFrame);

                if (itemid == VSConstants.VSITEMID_NIL)
                {
                    this.UnlockRdtEntry();
                }

                IVsSolution solution = this.GetService(typeof(IVsSolution)) as IVsSolution;
                if (solution == null)
                {
                    throw new InvalidOperationException();
                }

                ErrorHandler.ThrowOnFailure(solution.RemoveVirtualProject(this.nestedHierarchy, 0));

            }
            finally
            {
                this.StopObservingNestedProjectFile();

                // if we haven't already release the RDT cookie, do so now.
                if (itemid == VSConstants.VSITEMID_NIL)
                {
                    this.UnlockRdtEntry();
                }

                this.Dispose(true);
            }
        }

Usage Example

Esempio n. 1
0
        internal protected void RemoveNestedProjectNodes()
        {
            for (HierarchyNode n = this.FirstChild; n != null; n = n.NextSibling)
            {
                NestedProjectNode p = n as NestedProjectNode;
                if (p != null)
                {
                    p.CloseNestedProjectNode();
                }
            }

            // We do not care of file changes after this.
            this.NestedProjectNodeReloader.FileChangedOnDisk -= this.OnNestedProjectFileChangedOnDisk;
            this.NestedProjectNodeReloader.Dispose();
        }
All Usage Examples Of Microsoft.VisualStudio.Project.NestedProjectNode::CloseNestedProjectNode