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 = _commandTarget.HandlesCommand(commandId);
            }
            catch (Exception e) {
                Logger.LogException(e, "Error in {0}.HandlesCommand.", _commandTarget.GetType().FullName);
            }
            if (!isSupported)
            {
                return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText));
            }

            bool isEnabled = _commandTarget.IsEnabled(commandId);

            prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);
            if (isEnabled)
            {
                prgCmds[0].cmdf |= (uint)(OLECMDF.OLECMDF_ENABLED);
            }
            return(VSConstants.S_OK);
        }