/// <summary> /// This is called after our control has been created and sited. /// This is a good place to initialize the control with data gathered /// from Visual Studio services. /// </summary> public override void OnToolWindowCreated() { base.OnToolWindowCreated(); // Add the handler for our toolbar buttons CommandID id = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.cmdidLogListClear); DefineCommandHandler(new EventHandler(this.OnLogListClear), id); id = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.cmdidLogListPrev); DefineCommandHandler(new EventHandler(this.OnLogListPrev), id); id = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.cmdidLogListNext); DefineCommandHandler(new EventHandler(this.OnLogListNext), id); id = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.cmdidCombo); DefineCommandHandler(new EventHandler(this.OnCombo), id); id = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.cmdidComboGetList); DefineCommandHandler(new EventHandler(this.OnComboGetList), id); // Ensure the control's handle has been created; otherwise, BeginInvoke cannot be called. // Note that during runtime this should have no effect when running inside Visual Studio, // as the control's handle should already be created, but unit tests can end up calling // this method without the control being created. m_Control.InitializeComponent(); // setup output pane ListenerControl.MakeOutputPane(); }
/// <summary> /// Constructor for ToolWindowPane. /// Initialization that depends on the package or that requires access /// to VS services should be done in OnToolWindowCreated. /// </summary> public ListenerWindowPane() : base(null) { // Set the image that will appear on the tab of the window frame when docked with another window. // KnownMonikers is a set of image monkiers that are globablly recognized by VS. These images can be // used in any project without needing to include the source image. BitmapImageMoniker = Microsoft.VisualStudio.Imaging.KnownMonikers.GoToSourceCode; // Add the toolbar by specifying the Guid/MenuID pair corresponding to // the toolbar definition in the vsct file. ToolBar = new CommandID(GuidsList.guidClientCmdSet, PkgCmdId.IDM_MyToolbar); // Specify that we want the toolbar at the top of the window ToolBarLocation = (int)VSTWT_LOCATION.VSTWT_TOP; // Set the text that will appear in the title bar of the tool window. this.Caption = "NLV Listener"; // Creating the user control that will be displayed in the window - change this to content Content = (m_Control = new ListenerControl()); }