﻿Option Strict On
Option Explicit On

Imports System
Imports Microsoft.VisualBasic.ApplicationServices

Namespace My

    Partial Friend Class MyApplication

        Private Sub MyApplication_UnhandledException(sender As Object, e As Global.Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
            Dim caughtException As Global.System.Exception = Nothing
            If e IsNot Nothing Then caughtException = e.Exception

            Global.Nexamas.UI.Showcase.ShowcaseRuntimeFaultReporter.ReportFatal(
                "The Nexamas UI Showcase stopped at an unhandled application boundary.",
                caughtException)

            ' Continuing after an unhandled UI-thread exception leaves a partially
            ' initialized visual tree (the blank pale window that was observed).
            ' Exit deterministically instead of pretending the Showcase recovered.
            If e IsNot Nothing Then e.ExitApplication = True
        End Sub

    End Class

End Namespace
