void IDisposable.Dispose()
        {
            WorkflowView view = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView;

            if (view != null)
            {
                if (this.refreshTypesHandler != null)
                {
                    view.Idle -= this.refreshTypesHandler;
                }
                if (this.refreshDesignerActionsHandler != null)
                {
                    view.Idle -= this.refreshDesignerActionsHandler;
                }
                if (this.refreshTasksHandler != null)
                {
                    view.Idle -= this.refreshTasksHandler;
                }
            }
            this.refreshTypesHandler           = null;
            this.refreshDesignerActionsHandler = null;
            this.refreshTasksHandler           = null;
            IExtendedUIService service = this.serviceProvider.GetService(typeof(IExtendedUIService)) as IExtendedUIService;

            if (service != null)
            {
                service.RemoveDesignerActions();
            }
            IPropertyValueUIService service2 = this.serviceProvider.GetService(typeof(IPropertyValueUIService)) as IPropertyValueUIService;

            if (service2 != null)
            {
                service2.RemovePropertyValueUIHandler(new PropertyValueUIHandler(this.OnPropertyGridAdornments));
            }
            IComponentChangeService service3 = this.serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (service3 != null)
            {
                service3.ComponentChanged -= new ComponentChangedEventHandler(this.OnComponentChanged);
            }
            ISelectionService service4 = this.serviceProvider.GetService(typeof(ISelectionService)) as ISelectionService;

            if (service4 != null)
            {
                service4.SelectionChanged -= new EventHandler(this.OnSelectionChanged);
            }
            ITypeProvider provider = this.serviceProvider.GetService(typeof(ITypeProvider)) as ITypeProvider;

            if (provider != null)
            {
                provider.TypesChanged -= new EventHandler(this.OnTypeSystemTypesChanged);
            }
            IDesignerEventService service5 = this.serviceProvider.GetService(typeof(IDesignerEventService)) as IDesignerEventService;

            if (service5 != null)
            {
                service5.ActiveDesignerChanged -= new ActiveDesignerEventHandler(this.OnActiveDesignerChanged);
            }
            this.serviceProvider.LoadComplete -= new EventHandler(this.OnDesignerReloaded);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         IPropertyValueUIService service = (IPropertyValueUIService)this.GetService(typeof(IPropertyValueUIService));
         if (service != null)
         {
             service.RemovePropertyValueUIHandler(new PropertyValueUIHandler(this.OnGetUIValueItem));
         }
         IServiceContainer container = (IServiceContainer)this.GetService(typeof(IServiceContainer));
         if (container != null)
         {
             if (this._urlResolutionService != null)
             {
                 container.RemoveService(typeof(IUrlResolutionService));
             }
             container.RemoveService(typeof(IImplicitResourceProvider));
             if (this._designerActionService != null)
             {
                 this._designerActionService.Dispose();
             }
             this._designerActionUIService.Dispose();
         }
         this._urlResolutionService = null;
         this._component            = null;
     }
 }