private IVsWindowFrame CreateDocWindowForSolution() { // TODO: Need to wait until solution is loaded IVsWindowFrame windowFrame = null; IVsSolution solution = ServiceLocator.GetInstance <IVsSolution>(); IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); uint windowFlags = (uint)_VSRDTFLAGS.RDT_DontAddToMRU | (uint)_VSRDTFLAGS.RDT_DontSaveAs; var context = ServiceLocator.GetInstance <VsPackageManagerContext>(); var currentSolution = context.GetCurrentSolution(); if (!currentSolution.Projects.Any()) { // there are no supported projects. MessageHelper.ShowWarningMessage(VsResources.NoSupportedProjectsInSolution, Resources.ErrorDialogBoxTitle); return(windowFrame); } var myDoc = new PackageManagerModel(context.SourceManager, currentSolution); var NewEditor = new PackageManagerWindowPane(myDoc, ServiceLocator.GetInstance <IUserInterfaceService>()); var ppunkDocView = Marshal.GetIUnknownForObject(NewEditor); var ppunkDocData = Marshal.GetIUnknownForObject(myDoc); var guidEditorType = PackageManagerEditorFactory.EditorFactoryGuid; var guidCommandUI = Guid.Empty; var caption = String.Format( CultureInfo.CurrentCulture, Resx.Resources.Label_NuGetWindowCaption, myDoc.Target.Name); var documentName = _dte.Solution.FullName; int hr = uiShell.CreateDocumentWindow( windowFlags, documentName, (IVsUIHierarchy)solution, (uint)VSConstants.VSITEMID.Root, ppunkDocView, ppunkDocData, ref guidEditorType, null, ref guidCommandUI, null, caption, string.Empty, null, out windowFrame); ErrorHandler.ThrowOnFailure(hr); return(windowFrame); }
private IVsWindowFrame CreateDocWindow( Project project, string documentName, IVsHierarchy hier, uint itemId) { uint windowFlags = (uint)_VSRDTFLAGS.RDT_DontAddToMRU | (uint)_VSRDTFLAGS.RDT_DontSaveAs; var context = ServiceLocator.GetInstance <VsPackageManagerContext>(); var myDoc = new PackageManagerModel( context.SourceManager, context.GetCurrentVsSolution().GetProject(project)); var NewEditor = new PackageManagerWindowPane(myDoc, ServiceLocator.GetInstance <IUserInterfaceService>()); var ppunkDocView = Marshal.GetIUnknownForObject(NewEditor); var ppunkDocData = Marshal.GetIUnknownForObject(myDoc); var guidEditorType = PackageManagerEditorFactory.EditorFactoryGuid; var guidCommandUI = Guid.Empty; var caption = String.Format( CultureInfo.CurrentCulture, Resx.Resources.Label_NuGetWindowCaption, myDoc.Target.Name); IVsWindowFrame windowFrame; IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); int hr = uiShell.CreateDocumentWindow( windowFlags, documentName, (IVsUIHierarchy)hier, itemId, ppunkDocView, ppunkDocData, ref guidEditorType, null, ref guidCommandUI, null, caption, string.Empty, null, out windowFrame); ErrorHandler.ThrowOnFailure(hr); return(windowFrame); }