/// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> private void ShowToolWindow(object sender, EventArgs e) { VsTeamFoundationBuild tfsBuild = (VsTeamFoundationBuild)GetService(typeof(IVsTeamFoundationBuild)); // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } MyToolWindow myWindow = (MyToolWindow)window; MyControl myControl = (MyControl)myWindow.Content; myControl.Package = this; myControl.TfsBuild = tfsBuild; IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); }