/// <summary> /// Called when it is time for the tab order UI to go away. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (region != null) { region.Dispose(); region = null; } if (host != null) { IOverlayService os = (IOverlayService)host.GetService(typeof(IOverlayService)); if (os != null) { os.RemoveOverlay(this); } IEventHandlerService ehs = (IEventHandlerService)host.GetService(typeof(IEventHandlerService)); if (ehs != null) { ehs.PopHandler(this); } IMenuCommandService mcs = (IMenuCommandService)host.GetService(typeof(IMenuCommandService)); if (mcs != null) { foreach (MenuCommand mc in newCommands) { mcs.RemoveCommand(mc); } } // We sync add, remove and change events so we remain in sync with any nastiness that the // form may pull on us. // IComponentChangeService cs = (IComponentChangeService)host.GetService(typeof(IComponentChangeService)); if (cs != null) { cs.ComponentAdded -= new ComponentEventHandler(OnComponentAddRemove); cs.ComponentRemoved -= new ComponentEventHandler(OnComponentAddRemove); cs.ComponentChanged -= new ComponentChangedEventHandler(OnComponentChanged); } IHelpService hs = (IHelpService)host.GetService(typeof(IHelpService)); if (hs != null) { hs.RemoveContextAttribute("Keyword", "TabOrderView"); } host = null; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { if (this.region != null) { this.region.Dispose(); this.region = null; } if (this.host != null) { IOverlayService service = (IOverlayService)this.host.GetService(typeof(IOverlayService)); if (service != null) { service.RemoveOverlay(this); } IEventHandlerService service2 = (IEventHandlerService)this.host.GetService(typeof(IEventHandlerService)); if (service2 != null) { service2.PopHandler(this); } IMenuCommandService service3 = (IMenuCommandService)this.host.GetService(typeof(IMenuCommandService)); if (service3 != null) { foreach (MenuCommand command in this.newCommands) { service3.RemoveCommand(command); } } IComponentChangeService service4 = (IComponentChangeService)this.host.GetService(typeof(IComponentChangeService)); if (service4 != null) { service4.ComponentAdded -= new ComponentEventHandler(this.OnComponentAddRemove); service4.ComponentRemoved -= new ComponentEventHandler(this.OnComponentAddRemove); service4.ComponentChanged -= new ComponentChangedEventHandler(this.OnComponentChanged); } IHelpService service5 = (IHelpService)this.host.GetService(typeof(IHelpService)); if (service5 != null) { service5.RemoveContextAttribute("Keyword", "TabOrderView"); } this.host = null; } } base.Dispose(disposing); }