Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the ouput window from an add-in?

I currently have a visual studio add-in and have created a new output window pane which I can write text to successfully. However, when the output window is not open or it is minimised then it doesn't open (popup) when I call the Activate() method on the pane. Any ideas how I can achieve this?

like image 488
gouldos Avatar asked Oct 13 '22 22:10

gouldos


1 Answers

If you created your Add-in using the Add-in wizard you should have an Exec() method like below. I have added two lines that cause the Output window to open and become visible regardless whether it was originally closed or minimized. I tested this in VS2008 and VS2010.

public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
    handled = false;
    if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
    {
        if(commandName == "AddinTest.Connect.AddinTest")
        {
            // Find the output window.
            Window outputWindow = _applicationObject.Windows.Item(Constants.vsWindowKindOutput);
            // Show the window. (You might want to make sure outputWindow is not null here...)
            outputWindow.Visible = true;

            handled = true;
            return;
        }
    }
} 
like image 179
shaunmartin Avatar answered Nov 01 '22 09:11

shaunmartin