private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (!enterpriseLibraryConfigured)
            {
                // If something goes wrong before Enterprise Library has been configured, we can't use enterprise library
                // for exeption handling. The only thing we can do here is to report this to show an error message
                // Since the UI also has not been loaded yet, we need to create the root visual as a blank page
                App.Current.RootVisual = new UserControl();
                ErrorWindow.CreateNew("An unknown problem has occurred while starting the application", e.ExceptionObject, Guid.Empty, true);
                e.Handled = true;
                return;
            }

            // Call the Unhandled exception policy. This should:
            // 1. Log the error
            // 2. Show a friendly error message
            // 3. Exit the application
            var exceptionManager = EnterpriseLibraryContainer.Current.GetInstance <ExceptionManager>();

            exceptionManager.HandleException(e.ExceptionObject, ExceptionHandlingPolicies.UnhandledException);

            e.Handled = true;
        }
 /// <summary>
 /// If an error occurs during navigation, show an error window
 /// </summary>
 private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     e.Handled = true;
     ErrorWindow.CreateNew(e.Exception);
 }