Пример #1
0
        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());
            }
        }