Esempio n. 1
0
        virtual public IQueryStatusResult CommandBeforeQueryStatus(ICommandQueryStatusParams e)
        {
            var  result    = new QueryStatusResult();
            var  prgcmds   = (OLECMD[])e.PrgCmds;
            uint wtfisthis = prgcmds[0].cmdf;
            int  commandID = Convert.ToInt32(prgcmds[0].cmdID);

            if (CommandMap.ContainsKey(commandID))
            {
                var  mappedCommand = CommandMap[commandID];
                bool isVisible     = mappedCommand.BaseCommand.BeforeQueryStatus(mappedCommand.MenuCommand, new EventArgs());
                wtfisthis |= (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;
                if (!isVisible)
                {
                    wtfisthis = (uint)OLECMDF.OLECMDF_DEFHIDEONCTXTMENU | (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
                }
                result.IsVersionControlled = isVisible;
            }
            else
            {
            }
            result.PrgCmdsValue = wtfisthis;
            result.ReturnValue  = 0;
            return(result);
        }
        virtual public IQueryStatusResult CommandBeforeQueryStatus(ICommandQueryStatusParams e)
        {
            var result = new QueryStatusResult();
            var prgcmds = (OLECMD[])e.PrgCmds;
            uint wtfisthis = prgcmds[0].cmdf;
            int commandID = Convert.ToInt32(prgcmds[0].cmdID);

            if (CommandMap.ContainsKey(commandID))
            {
                var mappedCommand = CommandMap[commandID];
                bool isVisible = mappedCommand.BaseCommand.BeforeQueryStatus(mappedCommand.MenuCommand, new EventArgs());
                wtfisthis |= (uint) OLECMDF.OLECMDF_SUPPORTED | (uint) OLECMDF.OLECMDF_ENABLED;
                if (!isVisible)
                {
                    wtfisthis = (uint)OLECMDF.OLECMDF_DEFHIDEONCTXTMENU | (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
                }
                result.IsVersionControlled = isVisible;
            }
            else
            {
            }
            result.PrgCmdsValue = wtfisthis;
            result.ReturnValue = 0;
            return result;
        }