2
votes

I created the tool window extension in visual studio based on below link, How to ensure it is the first docked as tabbed window in the output project?

https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-a-tool-window?view=vs-2019

In the WizardPackage.cs these are the attributes am using

[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
    [Guid(TeamsWizardPackage.PackageGuidString)]
    [ProvideMenuResource("Menus.ctmenu", 0)]
    [ProvideToolWindow(typeof(TeamsWindow), Orientation = ToolWindowOrientation.Left, DocumentLikeTool = true, Style = Microsoft.VisualStudio.Shell.VsDockStyle.Tabbed, Window = "3ae79031-e1bc-11d0-8f78-00a0c9110057")]
    [ProvideToolWindowVisibility(typeof(TeamsWindow), VSConstants.UICONTEXT.SolutionExists_string, Name = "Teams Overview")]

The window is displayed at the third position. I need to show this window at the first position. I tried to close first two windows pro-grammatically but no clue on how to close them, Is there any way to show this window at the first position?

enter image description here

1

1 Answers

1
votes

I made it work by closing the first two windows.

Basically the window type for the first two windows is "Document" and the third window is of type "Tool".

Development tool window(DTE) window holds the output project/solution/windows which gets created.We can make use of it as shown below and close the first two windows by using the appropriate IWizard life cycle methods.

using EnvDTE;

 public DTE dte;

public void RunStarted(object automationObject,
 Dictionary<string, string> replacementsDictionary,           
  WizardRunKind runKind, object[] customParams)          
 {
dte = automationObject as DTE;
 }

public void RunFinished()
        {
            foreach (Window documentWindow in dte.Windows)
            {
        //close all Document type of windows from the output project  
                if (documentWindow.Kind == "Document")
                {
                    documentWindow.Close();
                }
            }

        }