int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { // Don't do anything here. This function is 100% performance critical! return (int)OleConstants.OLECMDERR_E_NOTSUPPORTED; }
/// <inheritdoc/> int IOleCommandTarget.QueryStatus(ref Guid guidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { Guid cmdGroup = guidCmdGroup; for (uint i = 0; i < cCmds; i++) { OLECMDF status = QueryCommandStatus(ref cmdGroup, prgCmds[i].cmdID); if (status == default(OLECMDF) && _next != null) { if (_next != null) return _next.QueryStatus(ref cmdGroup, cCmds, prgCmds, pCmdText); else return (int)OleConstants.OLECMDERR_E_NOTSUPPORTED; } prgCmds[i].cmdf = (uint)status; } return VSConstants.S_OK; }
public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { return _oldTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText); }
public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { return RouteQueryStatus(Route, ref pguidCmdGroup, cCmds, prgCmds, pCmdText); }
private static int RouteQueryStatus(Func<CommandTargetParameters, RoutedCommand, bool> canExecuteFunc, ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { RoutedCommand command = InheritanceMarginPackage.Instance.FindCommand(pguidCmdGroup, prgCmds[0].cmdID); if (command == null) return (int)OleConstants.MSOCMDERR_E_UNKNOWNGROUP; string commandText = GetCommandText(pCmdText); CommandTargetParameters @params = CommandTargetParameters.CreateInstance(prgCmds[0].cmdID, commandText); if (!canExecuteFunc(@params, command)) return (int)OleConstants.MSOCMDERR_E_NOTSUPPORTED; prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED; prgCmds[0].cmdf |= @params.Enabled ? (uint)OLECMDF.OLECMDF_ENABLED : 0; prgCmds[0].cmdf |= [email protected] ? (uint)OLECMDF.OLECMDF_INVISIBLE : 0; prgCmds[0].cmdf |= @params.Pressed ? (uint)OLECMDF.OLECMDF_LATCHED : 0; if (@params.Text == null) @params.Text = string.Empty; if (commandText != @params.Text) SetCommandText(pCmdText, @params.Text); return VSConstants.S_OK; }
private static int RouteQueryStatus(IInputElement routing, ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { return RouteQueryStatus((args, command) => command.CanExecute(args, routing), ref pguidCmdGroup, cCmds, prgCmds, pCmdText); }
/// <inheritdoc/> int IOleCommandTarget.QueryStatus(ref Guid guidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { using (OleCommandText oleCommandText = OleCommandText.FromQueryStatus(pCmdText)) { Guid cmdGroup = guidCmdGroup; for (uint i = 0; i < cCmds; i++) { OLECMDF status = QueryCommandStatus(ref cmdGroup, prgCmds[i].cmdID, oleCommandText); if (status == default(OLECMDF) && _next != null) { int hr = _next.QueryStatus(ref cmdGroup, cCmds, prgCmds, pCmdText); if (ErrorHandler.Failed(hr)) return hr; } else { prgCmds[i].cmdf = (uint)status; } } return VSConstants.S_OK; } }