コード例 #1
0
        // this ctor doesn't load the surface
        //
        public DesignSurface(IServiceProvider parentProvider)
        {
            _serviceContainer = new DesignSurfaceServiceContainer(parentProvider);
            _designerHost     = new DesignerHost((IServiceProvider)_serviceContainer);
            _designerHost.DesignerLoaderHostLoaded    += new LoadedEventHandler(OnDesignerHost_Loaded);
            _designerHost.DesignerLoaderHostLoading   += new EventHandler(OnDesignerHost_Loading);
            _designerHost.DesignerLoaderHostUnloading += new EventHandler(OnDesignerHost_Unloading);
            _designerHost.DesignerLoaderHostUnloaded  += new EventHandler(OnDesignerHost_Unloaded);

            _designerHost.Activated += new EventHandler(OnDesignerHost_Activated);

            _serviceContainer.AddNonReplaceableService(typeof(IComponentChangeService), _designerHost);
            _serviceContainer.AddNonReplaceableService(typeof(IDesignerHost), _designerHost);
            _serviceContainer.AddNonReplaceableService(typeof(IContainer), _designerHost);
            _serviceContainer.AddNonReplaceableService(typeof(IServiceContainer), _serviceContainer);
            _serviceContainer.AddService(typeof(ITypeDescriptorFilterService),
                                         (ITypeDescriptorFilterService) new TypeDescriptorFilterService(_serviceContainer));

            ExtenderService extenderService = new ExtenderService();

            _serviceContainer.AddService(typeof(IExtenderProviderService), (IExtenderProviderService)extenderService);
            _serviceContainer.AddService(typeof(IExtenderListService), (IExtenderListService)extenderService);
            UISelectionService selection = new UISelectionService((IServiceProvider)_serviceContainer);

            _serviceContainer.AddService(typeof(ISelectionService), (ISelectionService)selection);
            _serviceContainer.AddService(typeof(IUISelectionService), (IUISelectionService)selection);
            _serviceContainer.AddService(typeof(DesignSurface), this);
        }
コード例 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (_designerLoader != null)
            {
                _designerLoader.Dispose();
                _designerLoader = null;
            }
            if (_designerHost != null)
            {
                _designerHost.Dispose();
                _designerHost.DesignerLoaderHostLoaded    -= new LoadedEventHandler(OnDesignerHost_Loaded);
                _designerHost.DesignerLoaderHostLoading   -= new EventHandler(OnDesignerHost_Loading);
                _designerHost.DesignerLoaderHostUnloading -= new EventHandler(OnDesignerHost_Unloading);
                _designerHost.DesignerLoaderHostUnloaded  -= new EventHandler(OnDesignerHost_Unloaded);
                _designerHost.Activated -= new EventHandler(OnDesignerHost_Activated);
                _designerHost            = null;
            }
            if (_serviceContainer != null)
            {
                _serviceContainer.Dispose();
                _serviceContainer = null;
            }

            if (Disposed != null)
            {
                Disposed(this, EventArgs.Empty);
            }
        }
コード例 #3
0
 public override void Remove(IComponent component)
 {
     if (this.Owner.Site != null)
     {
         DesignerHost host = this.Owner.Site.GetService(typeof(IDesignerHost)) as DesignerHost;
         if (host != null)
         {
             base.Remove(component);
             host.RemoveCore(component);
         }
     }
 }
コード例 #4
0
 public override void Add(IComponent component, string name)
 {
     if (this.Owner.Site != null)
     {
         DesignerHost host = this.Owner.Site.GetService(typeof(IDesignerHost)) as DesignerHost;
         if (host != null)
         {
             base.Add(component, name);
             host.AddCore(component, name);
         }
     }
 }
コード例 #5
0
 public DesignerHostTransaction(DesignerHost host, string description) : base(description)
 {
     _designerHost = host;
 }