public SplashScreenApplication() { // Register for the application idle loop. This prevents the class from calling // a virtual method (CreateSplashScreen) inside its constructor. Application.Idle += ApplicationOnIdle; // Create the presenter and wire the events. By doing this in the constructor, it // allows the derived class to set properties on the presenter (copyright, company name, etc). Presenter = new SplashScreenPresenter(); Presenter.SplashScreenDisplayed += PresenterOnSplashScreenDisplayed; Presenter.SplashScreenClosed += PresenterOnSplashScreenClosed; }
private void PresenterOnSplashScreenClosed(object sender, EventArgs e) { OnSplashScreenClosed(); RaiseSplashScreenClosed(this, e); // unsubscribe events so that the presenter will be garbage collected Presenter.SplashScreenDisplayed -= PresenterOnSplashScreenDisplayed; Presenter.SplashScreenClosed -= PresenterOnSplashScreenClosed; Presenter.Dispose(); Presenter = null; }