Esempio n. 1
0
        //- The DesignSurface class provides several design-time services automatically. The DesignSurface class adds all of its services in its constructor.
        //- Most of these services can be overridden by replacing them in the protected ServiceContainer property.To replace a service, override the constructor,
        //- call base, and make any changes through the protected ServiceContainer property.
        private void InitServices()
        {
            //- Each DesignSurface has its own default services, We can leave the default services in their present state,
            //- or we can remove them and replace them with our own. Now add our own services using IServiceContainer.

            //- Note, before loading the root control in the design surface, we must add an instance of naming service to the service container.
            //- otherwise the root component did not have a name and this caused troubles when we try to use the UndoEngine

            //- 1. NameCreationService
            _nameCreationService = new Service.NameCreationServiceImp();
            InitServier(typeof(INameCreationService), _nameCreationService);

            //- 2. CodeDomComponentSerializationService, the CodeDomComponentSerializationService is ready to be replaced
            _codeDomComponentSerializationService = new CodeDomComponentSerializationService(this.ServiceContainer);
            InitServier(typeof(ComponentSerializationService), _codeDomComponentSerializationService);

            //- 3. IDesignerSerializationService, the IDesignerSerializationService is ready to be replaced
            _designerSerializationService = new Service.DesignerSerializationServiceImpl(this.ServiceContainer);
            InitServier(typeof(IDesignerSerializationService), _designerSerializationService);

            _eventService = new Service.EventBindingServiceImpl(this.ServiceContainer);
            InitServier(typeof(IEventBindingService), _eventService);

            //- 4. UndoEngine, the UndoEngine is ready to be replaced
            _undoService         = new Service.UndoServiceImpl(this.ServiceContainer);
            _undoService.Enabled = false;   //- disable the UndoEngine
            InitServier(typeof(UndoEngine), _undoService);

            //- 5. IMenuCommandService
            InitServier(typeof(IMenuCommandService), new MenuCommandService(this));
        }
Esempio n. 2
0
 ///     Creates a new EventPropertyDescriptor.
 internal EventPropertyDescriptor(EventDescriptor eventDesc, EventBindingServiceImpl eventSvc) : base(eventDesc, null)
 {
     _eventDesc = eventDesc;
     _eventSvc  = eventSvc;
 }