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); }
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; }
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); }
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); } } }
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); } } }
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; }