public override void OnToolWindowCreated() { base.OnToolWindowCreated(); var frame = (IVsWindowFrame)Frame; object ouhw; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out ouhw)); // initialie w/ our hierarchy var hw = ouhw as IVsUIHierarchyWindow; _sessions = new SessionsNode((IServiceProvider)Package, hw); object punk; ErrorHandler.ThrowOnFailure(hw.Init( _sessions, (uint)(__UIHWINFLAGS.UIHWF_SupportToolWindowToolbars | __UIHWINFLAGS.UIHWF_InitWithHiddenParentRoot | __UIHWINFLAGS.UIHWF_HandlesCmdsAsActiveHierarchy), out punk )); // add our toolbar which is defined in our VSCT file object otbh; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out otbh)); IVsToolWindowToolbarHost tbh = otbh as IVsToolWindowToolbarHost; Guid guidPerfMenuGroup = GuidList.guidPythonProfilingCmdSet; ErrorHandler.ThrowOnFailure(tbh.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref guidPerfMenuGroup, PkgCmdIDList.menuIdPerfToolbar)); }
void OnLoad(object sender, EventArgs e) { if (_fKeys == null) { _fKeys = GetService <IVsFilterKeys2>(typeof(SVsFilterKeys)); } if (_form.ToolBar != 0) { System.ComponentModel.Design.CommandID tbId = new System.ComponentModel.Design.CommandID(AnkhId.CommandSetGuid, (int)_form.ToolBar); if (_tbHost == null) { IVsUIShell uiShell = GetService <IVsUIShell>(typeof(SVsUIShell)); Marshal.ThrowExceptionForHR(uiShell.SetupToolbar(_form.Handle, (IVsToolWindowToolbar)this, out _tbHost)); } Guid toolbarCommandSet = tbId.Guid; Marshal.ThrowExceptionForHR( _tbHost.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref toolbarCommandSet, (uint)tbId.ID)); Marshal.ThrowExceptionForHR(_tbHost.Show(0)); Marshal.ThrowExceptionForHR(_tbHost.ForceUpdateUI()); } }
/// <summary> /// Initialize here after we have the frame so we can grab the toolbar host /// </summary> protected override void Initialize() { base.Initialize(); IVsToolWindowToolbarHost host = ToolBarHost; Debug.Assert(host != null); // Should be set with HasToolbar true if (host != null) { CommandID command = ORMDesignerDocView.ORMDesignerCommandIds.ViewSamplePopulationEditor; Guid commandGuid = command.Guid; host.AddToolbar(VSTWT_LOCATION.VSTWT_LEFT, ref commandGuid, (uint)command.ID); } }
/// <summary> /// Initialize here after we have the frame so we can grab the toolbar host /// </summary> protected override void Initialize() { base.Initialize(); IVsToolWindowToolbarHost host = ToolBarHost; Debug.Assert(host != null); // Should be set with HasToolbar true if (host != null) { CommandID command = ORMDesignerDocView.ORMDesignerCommandIds.VerbalizationToolBar; Guid commandGuid = command.Guid; host.AddToolbar(VSTWT_LOCATION.VSTWT_LEFT, ref commandGuid, (uint)command.ID); } // create the string writer to hold the html StringBuilder builder = new StringBuilder(); myStringWriter = new StringWriter(builder, CultureInfo.CurrentCulture); UpdateVerbalization(); }
public override void OnToolBarAdded() { base.OnToolBarAdded(); if (ExtraToolBarId != AnkhToolBar.None) { IVsWindowFrame frame = (IVsWindowFrame)this.Frame; object obj; if (frame != null && VSErr.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out obj))) { IVsToolWindowToolbarHost host = obj as IVsToolWindowToolbarHost; Guid g = AnkhId.CommandSetGuid; host.AddToolbar((VSTWT_LOCATION)ToolBarLocation, ref g, (uint)ExtraToolBarId); } } _twControl.OnFrameCreated(EventArgs.Empty); }