/// <summary> /// Somehow a slice (I think one that has never scrolled to become visible?) /// can get an OnLoad message for its view in the course of deleting it from the /// parent controls collection. This can be bad (at best it's a waste of time /// to do the Layout in the OnLoad, but it can be actively harmful if the object /// the view is displaying has been deleted). So suppress it. /// </summary> public override void AboutToDiscard() { CheckDisposed(); base.AboutToDiscard(); ButtonLauncher launcher = this.Control as ButtonLauncher; if (launcher == null) { return; } SIL.FieldWorks.Common.RootSites.SimpleRootSite rs = launcher.MainControl as SIL.FieldWorks.Common.RootSites.SimpleRootSite; if (rs != null) { rs.AboutToDiscard(); } }