private void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is NodeNotFoundException)
{
((MainPage) RootVisual).Loader.Visibility = Visibility.Collapsed;
SuperMessageBoxService.Show(
"Load Map Failed",
"Sorry, unfortunately we can’t find the map you’re looking for",
"Select a new map",
"Cancel",
MessageBoxType.Error,
() => ((MainPage) RootVisual).HomeScreen()
);
}
else if (e.ExceptionObject.InnerException != null)
{
if (e.ExceptionObject.InnerException is TimeoutException)
{
((MainPage) RootVisual).Loader.Visibility = Visibility.Collapsed;
SuperMessageBoxService.Show(
"Communication Failed",
"Unfortunately it seems your internet connection is not working",
"Refresh",
"Cancel",
MessageBoxType.Error,
() => HtmlPage.Document.Submit()
);
}
}
else
{
var unhandledExceptionDialog = new UnhandledExceptionDialog();
unhandledExceptionDialog.UnhandledException = e.ExceptionObject;
unhandledExceptionDialog.Show();
}
}