private void CloseEventPage(bool closeApp)
        {
            // Fire the closed event
            if (_windowManager != null)
            {
                WindowManager.NoWindowsOpen -= OnWindowManagerNoWindowsOpen;
                _windowManager.Shutdown();
                _windowManager = null;
            }

            if (_eventPageUnloadTimer != null)
            {
                _eventPageUnloadTimer.Dispose();
                _eventPageUnloadTimer = null;
            }

            if (_eventPageBrowser != null)
            {
                _eventPageBrowser.RenderProcessTerminated -= OnRenderProcessTerminated;
                _eventPageBrowser.Close(true);
                if (closeApp)
                {
                    CloseApplication();
                }
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (_windowManager != null)
            {
                _windowManager.NoWindowsOpen  -= OnWindowManagerNoWindowsOpen;
                _windowManager.CreatingWindow -= OnWindowManagerCreatingWindow;
                _windowManager.CreatedWindow  -= OnWindowManagerCreatedWindow;
                _windowManager = null;
            }

            _schemeHandler = null;

            if (_eventPageLaunchTimer != null)
            {
                _eventPageLaunchTimer.Dispose();
                _eventPageLaunchTimer = null;
            }
            if (_router != null)
            {
                _router.Dispose();
                _router = null;
            }
            if (_eventPageBrowser != null)
            {
                _eventPageBrowser.Dispose();
                _eventPageBrowser = null;
            }

            if (_appRegistrationToken != null)
            {
                _appRegistrationToken.Dispose();
                _appRegistrationToken = null;
            }

            if (_setCookieEvent != null)
            {
                _setCookieEvent.Close();
                _setCookieEvent = null;
            }

            if (_eventPageUnloadTimer != null)
            {
                _eventPageUnloadTimer.Dispose();
                _eventPageUnloadTimer = null;
            }
        }