public virtual int Exec(ref Guid cmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { ThreadHelper.ThrowIfNotOnUIThread(); if (cmdGroup == VSConstants.VSStd2K) { switch ((VSConstants.VSStd2KCmdID)nCmdID) { case VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU: AnkhCommandMenu menu = Language.DefaultContextMenu; if (menu != 0) { ShowContextMenu(AnkhId.CommandSetGuid, (int)menu, this); } else { ShowContextMenu(VsMenus.guidSHLMainMenu, VsMenus.IDM_VS_CTXT_CODEWIN, this); } return(VSErr.S_OK); } } if (_fallThrough != null) { return(_fallThrough.Exec(ref cmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut)); } else { return(VSErr.E_FAIL); // delegate to next command target. } }
public void ShowContextMenu(AnkhCommandMenu menu, int x, int y) { IMenuCommandService mcs = GetService <IMenuCommandService>(); IVsUIShell shell = GetService <IVsUIShell>(); if (mcs != null) { try { mcs.ShowContextMenu(new CommandID(AnkhId.CommandSetGuid, (int)menu), x, y); } catch (COMException) { /* Menu is not declared correctly (no items) */ } } }
public void ShowContextMenu(AnkhCommandMenu menu, System.Drawing.Point location) { ShowContextMenu(menu, location.X, location.Y); }
public void ShowContextMenu(AnkhCommandMenu menu, int x, int y) { IMenuCommandService mcs = GetService<IMenuCommandService>(); IVsUIShell shell = GetService<IVsUIShell>(); if (mcs != null) { try { mcs.ShowContextMenu(new CommandID(AnkhId.CommandSetGuid, (int)menu), x, y); } catch (COMException) { /* Menu is not declared correctly (no items) */ } } }