Breaking News

c# – How to display custom tool window at the first position, programmatically in visual studio-Exceptionshub

Questions:

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

How to&Answers:

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 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();
                }
            }

        }

About rankhawks

Check Also

jQuery offline slideshow on Android-Exceptionshub

(function($){ $.fn.chocolate = function(args) { // Default Options var options = $.extend({ interval : 1000, …

c# – How to handle mocking (Rhino Mock) and unity container in different unit test classes?-Exceptionshub

Questions: I am working on a large desktop application. The application communicates with number of …

javascript – Actualize Database Data with Functions Cloud-Exceptionshub

Questions: I am developing an Android application and I have a problem that I cannot …

valgrind for Android devices (Crystax). configure: error: C compiler cannot create executables-Exceptionshub

Questions: Using and adapting the script(https://gist.github.com/smits/27060b310546ca6f76568f24838118c3) I get and error ” C compiler cannot create …

c# – Save position of Snake and Detect Collison with it self. Whats wrong?-Exceptionshub

Questions: using System; using System.Windows.Forms; using System.Collections.Generic; using System.Drawing; using OpenTK; using OpenTK.Graphics.OpenGL; using OpenTK.Graphics; …

Leave a Reply

Your email address will not be published. Required fields are marked *