AspNetEdit.Editor.UI.PropertyGrid.InitialiseServices C# (CSharp) Method

InitialiseServices() public method

public InitialiseServices ( ) : void
return void
        public void InitialiseServices()
        {
            //unregister old event handlers
            if (selectionService != null)
                selectionService.SelectionChanged -= new EventHandler(selectionService_SelectionChanged);

            //update references
            extenderListService = parentServices.GetService (typeof (IExtenderListService)) as IExtenderListService;
            selectionService = parentServices.GetService (typeof (ISelectionService)) as ISelectionService;
            changeService = parentServices.GetService (typeof (IComponentChangeService)) as IComponentChangeService;
            typeDescriptorFilterService = parentServices.GetService (typeof (ITypeDescriptorFilterService)) as ITypeDescriptorFilterService;

            //register event handlers
            if (selectionService != null)
                selectionService.SelectionChanged += new EventHandler (selectionService_SelectionChanged);
            if (changeService != null) {
                changeService.ComponentAdded += new ComponentEventHandler (changeService_ComponentAdded);
                changeService.ComponentRemoved += new ComponentEventHandler (changeService_ComponentRemoved);
                changeService.ComponentRename += new ComponentRenameEventHandler (changeService_ComponentRename);
                changeService.ComponentChanged += new ComponentChangedEventHandler (changeService_updateValues);
                /*TODO: should we also monitor these?
                changeService.ComponentAdding
                changeService.ComponentChanging
                changeService.ComponentRemoving
                */
            }

            //get existing components for combo list
            IDesignerHost host = parentServices.GetService (typeof (IDesignerHost)) as IDesignerHost;
            if (host != null)
                foreach (IComponent comp in host.Container.Components)
                    changeService_ComponentAdded(host.Container, new ComponentEventArgs (comp));
        }