Example #1
0
        private static void OnDispatch(EventHandler <ComponentEventArgs> dispatched, VB.VBComponent vbComponent)
        {
            var handler = dispatched;

            if (handler != null)
            {
                var component = new VBComponent(vbComponent);
                var project   = component.Collection.Parent;
                if (project.Protection != ProjectProtection.Locked)
                {
                    handler.Invoke(component, new ComponentEventArgs(project.ProjectId, project, component));
                }
            }
        }
Example #2
0
        private static void OnComponentRenamed(VB.VBComponent vbComponent, string oldName)
        {
            var handler = ComponentRenamed;

            if (handler != null)
            {
                var component = new VBComponent(vbComponent);
                var project   = component.Collection.Parent;
                if (project.Protection != ProjectProtection.Locked)
                {
                    handler.Invoke(component, new ComponentRenamedEventArgs(project.ProjectId, project, new VBComponent(vbComponent), oldName));
                }
            }
        }
Example #3
0
        public QualifiedSelection?GetQualifiedSelection()
        {
            if (IsWrappingNullReference)
            {
                return(null);
            }

            var selection = GetSelection();

            if (selection.IsEmpty())
            {
                return(null);
            }

            var component  = new VBComponent((VB.VBComponent)CodeModule.Parent.Target);
            var moduleName = new QualifiedModuleName(component);

            return(new QualifiedSelection(moduleName, selection));
        }
        void VB._dispVBComponentsEvents.ItemRenamed(VB.VBComponent VBComponent, string OldName)
        {
            using (var component = new VBComponent(VBComponent))
            {
                var handler = ComponentRenamed;
                if (handler == null)
                {
                    return;
                }

                using (var components = component.Collection)
                    using (var project = components.Parent)
                    {
                        if (project.Protection == ProjectProtection.Locked)
                        {
                            return;
                        }
                    }

                var qmn = new QualifiedModuleName(component);
                handler.Invoke(component, new ComponentRenamedEventArgs(qmn, OldName));
            }
        }
        private static void OnDispatch(EventHandler <ComponentEventArgs> dispatched, VB.VBComponent vbComponent)
        {
            using (var component = new VBComponent(vbComponent))
            {
                var handler = dispatched;
                if (handler == null)
                {
                    return;
                }

                using (var components = component.Collection)
                    using (var project = components.Parent)
                    {
                        if (project.Protection == ProjectProtection.Locked)
                        {
                            return;
                        }

                        var qmn       = new QualifiedModuleName(component);
                        var eventArgs = new ComponentEventArgs(qmn);
                        handler.Invoke(component, eventArgs);
                    }
            }
        }