コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: CommandFilter.cs プロジェクト: haiiev/GitDiffMargin
        /// <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;
        }
コード例 #3
0
 public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
 {
     return _oldTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
 }
コード例 #4
0
 public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
 {
     return RouteQueryStatus(Route, ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
 }
コード例 #5
0
        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;
        }
コード例 #6
0
 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);
 }
コード例 #7
0
ファイル: CommandFilter.cs プロジェクト: modulexcite/vsbase
        /// <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;
            }
        }