Beispiel #1
0
        /// <summary>
        ///     Helper method to stop the bootstrapper, if needed
        /// </summary>
        private async Task StopBootstrapperAsync()
        {
            // TODO: What to disable here? Ist un-registering the exception handlers here smart?
            // Unhook unhandled exceptions in the Dispatcher
            DispatcherUnhandledException -= HandleDispatcherException;

            // Unhook unhandled exceptions in the AppDomain
            AppDomain.CurrentDomain.UnhandledException -= HandleAppDomainException;

            // Unhook unhandled exceptions in tasks
            TaskScheduler.UnobservedTaskException -= HandleTaskException;

            // Shutdown Caliburn Micro
            _caliburnMicroBootstrapper.Shutdown();

            await _bootstrapper.ShutdownAsync().ConfigureAwait(true);

            // Make sure everything is disposed (and all disposables which were registered via _bootstrapper.RegisterForDisposal() are called)
            _bootstrapper.Dispose();
        }