コード例 #1
0
        public VsDevExpressMenuItem CreateItem(bool isPopup)
        {
            if (VsSource == null)
            {
                return(null);
            }
            var commandBarControl = (CommandBarControl)VsSource;

            if (commandBarControl.Type != MsoControlType.msoControlPopup)
            {
                CommandBar parentCommandBar = commandBarControl.Parent;
                if (parentCommandBar == null)
                {
                    return(null);
                }
                int savedIndex = commandBarControl.Index;
                VsSource = parentCommandBar.Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, savedIndex, Type.Missing) as CommandBarPopup;
                commandBarControl.Delete();
            }
            var childItem = new VsDevExpressMenuItem();

            childItem.VsSource = isPopup
                ? ((CommandBarPopup)VsSource).Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, Type.Missing, Type.Missing)
                : ((CommandBarPopup)VsSource).Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            ItemsInternal.Add(childItem);
            childItem.Parent = this;
            return(childItem);
        }
コード例 #2
0
        public void GenerateDefault()
        {
            devExpressMenu = new VSDevExpressMenu(dte);
            rootMenuHierarchy[string.Empty] = devExpressMenu;
            string wizardMenuText = "Create merge request...";
            VsDevExpressMenuItem mergeRequestMenu = devExpressMenu.CreateOrGetItem(wizardMenuText);

            mergeRequestMenu.Click += MergeRequestMenuOnClick;
            //string optionsMenuText = "Settings...";
            //VsDevExpressMenuItem optionsMenu = devExpressMenu.CreateOrGetItem(optionsMenuText);
            //optionsMenu.Click += OptionsMenuOnCLick;
        }
コード例 #3
0
        public VsDevExpressMenuItem CreateOrGetItem(string header, bool isPopup = false)
        {
            VsDevExpressMenuItem childItem = GetItemByHeader(header);

            if (childItem != null)
            {
                return(childItem);
            }
            childItem        = CreateItem(isPopup);
            childItem.Header = header;
            return(childItem);
        }
コード例 #4
0
        protected void CreateChildrenFromSource()
        {
            var commandBarPopup = VsSource as CommandBarPopup;

            if (commandBarPopup == null)
            {
                return;
            }
            foreach (CommandBarControl control in commandBarPopup.Controls)
            {
                if (control.Type == MsoControlType.msoControlButton || control.Type == MsoControlType.msoControlPopup)
                {
                    var item = new VsDevExpressMenuItem(control);
                    item.Parent = this;
                    ItemsInternal.Add(item);
                }
            }
        }
コード例 #5
0
ファイル: MenuItems.cs プロジェクト: Xarlot/DXVcs2Git
 protected void CreateChildrenFromSource()
 {
     var commandBarPopup = VsSource as CommandBarPopup;
     if (commandBarPopup == null)
         return;
     foreach (CommandBarControl control in commandBarPopup.Controls) {
         if (control.Type == MsoControlType.msoControlButton || control.Type == MsoControlType.msoControlPopup) {
             var item = new VsDevExpressMenuItem(control);
             item.Parent = this;
             ItemsInternal.Add(item);
         }
     }
 }
コード例 #6
0
ファイル: MenuItems.cs プロジェクト: Xarlot/DXVcs2Git
 public VsDevExpressMenuItem CreateItem(bool isPopup)
 {
     if (VsSource == null)
         return null;
     var commandBarControl = (CommandBarControl)VsSource;
     if (commandBarControl.Type != MsoControlType.msoControlPopup) {
         CommandBar parentCommandBar = commandBarControl.Parent;
         if (parentCommandBar == null)
             return null;
         int savedIndex = commandBarControl.Index;
         VsSource = parentCommandBar.Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, savedIndex, Type.Missing) as CommandBarPopup;
         commandBarControl.Delete();
     }
     var childItem = new VsDevExpressMenuItem();
     childItem.VsSource = isPopup
         ? ((CommandBarPopup)VsSource).Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, Type.Missing, Type.Missing)
         : ((CommandBarPopup)VsSource).Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
     ItemsInternal.Add(childItem);
     childItem.Parent = this;
     return childItem;
 }