Esempio n. 1
0
            public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
            {
                var commandId = new CommandID(pguidCmdGroup, (int)prgCmds[0].cmdID);

                bool isSupported = false;

                try {
                    isSupported = _owner._commandTarget.HandlesCommand(commandId);
                }
                catch (Exception e) {
                    Logger.LogError(e, "Error in {0}.HandlesCommand.", _owner._commandTarget.GetType().FullName);
                }
                if (!isSupported)
                {
                    if (_owner.NextCommandTarget == null)
                    {
                        return((int)Constants.OLECMDERR_E_NOTSUPPORTED);
                    }
                    else
                    {
                        return(OleCommandTargetSpy.WrapQueryStatus(_owner, _owner.NextCommandTarget, ref pguidCmdGroup, cCmds, prgCmds, pCmdText));
                    }
                }

                bool isEnabled = _owner._commandTarget.IsEnabled(commandId);

                prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);
                if (isEnabled)
                {
                    prgCmds[0].cmdf |= (uint)(OLECMDF.OLECMDF_ENABLED);
                }
                return(VSConstants.S_OK);
            }
Esempio n. 2
0
 public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
 {
     return(OleCommandTargetSpy.WrapQueryStatus(this, _impl, ref pguidCmdGroup, cCmds, prgCmds, pCmdText));
 }