protected override void Dispose(bool disposing) { if (disposing) { IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService)); service.ComponentChanged -= new ComponentChangedEventHandler(this.OnComponentChanged); IServiceContainer container = (IServiceContainer) this.GetService(typeof(IServiceContainer)); if (container != null) { container.RemoveService(typeof(IWebFormReferenceManager)); container.RemoveService(typeof(IEventBindingService)); container.RemoveService(typeof(ITypeResolutionService)); container.RemoveService(typeof(ITemplateEditingService)); } if (this._referenceManager != null) { ((IDisposable) this._referenceManager).Dispose(); this._referenceManager = null; } } base.Dispose(disposing); }
public override void Initialize(IComponent component) { base.Initialize(component); IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService)); service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged); IServiceContainer serviceProvider = (IServiceContainer) this.GetService(typeof(IServiceContainer)); if (serviceProvider != null) { ITypeResolutionService serviceInstance = (ITypeResolutionService) this.GetService(typeof(ITypeResolutionService)); this._referenceManager = new Microsoft.Matrix.Packages.Web.Designer.WebFormsReferenceManager(serviceProvider, ((WebFormsDocument) component).RegisterDirectives); serviceProvider.AddService(typeof(IWebFormReferenceManager), this._referenceManager); serviceProvider.AddService(typeof(IEventBindingService), this); serviceProvider.AddService(typeof(ITypeResolutionService), serviceInstance); serviceProvider.AddService(typeof(ITemplateEditingService), new Microsoft.Matrix.Packages.Web.Services.TemplateEditingService(serviceProvider)); } }