コード例 #1
0
ファイル: VBProjects.cs プロジェクト: shairad/Rubberduck
        private static void OnDispatch(EventHandler <ProjectEventArgs> dispatched, VB.VBProject vbProject, bool assignId = false)
        {
            var handler = dispatched;

            if (handler != null && vbProject.Protection != VB.vbext_ProjectProtection.vbext_pp_locked)
            {
                var project = new VBProject(vbProject);
                if (assignId)
                {
                    project.AssignProjectId();
                }
                var projectId = project.ProjectId;
                if (projectId != null)
                {
                    handler.Invoke(project, new ProjectEventArgs(projectId, project));
                }
            }
        }
コード例 #2
0
        private void OnDispatch(EventHandler <ProjectEventArgs> dispatched, VB.VBProject vbProject, bool assignId = false)
        {
            var project = new VBProject(vbProject);
            var handler = dispatched;

            if (handler == null || !IsInDesignMode() || vbProject.Protection == VB.vbext_ProjectProtection.vbext_pp_locked)
            {
                project.Dispose();
                return;
            }

            if (assignId)
            {
                project.AssignProjectId();
            }
            var projectId = project.ProjectId;

            if (projectId == null)
            {
                project.Dispose();
                return;
            }
            handler.Invoke(project, new ProjectEventArgs(projectId, project));
        }