protected override bool EvaluateCanExecute(object parameter)
        {
            if (!base.EvaluateCanExecute(parameter) ||
                !(parameter is CodeExplorerItemViewModel node) ||
                !(node.Declaration?.Project is IVBProject project))
            {
                return(false);
            }

            try
            {
                if (Vbe.ProjectsCount != 1)
                {
                    return(AllowableProjectTypes.Contains(project.Type));
                }

                using (var vbProjects = Vbe.VBProjects)
                    using (project = vbProjects[1])
                    {
                        return(AllowableProjectTypes.Contains(project.Type));
                    }
            }
            catch (COMException)
            {
                return(false);
            }
        }
Beispiel #2
0
        private bool SpecialEvaluateCanExecute(object parameter)
        {
            if (!(parameter is CodeExplorerItemViewModel node) ||
                node.Declaration == null)
            {
                return(false);
            }

            try
            {
                var project = node.Declaration.Project;
                return(AllowableProjectTypes.Contains(project.Type));
            }
            catch (COMException)
            {
                return(false);
            }
        }