private static void HandleUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is Exception)
DisplayError(e.ExceptionObject as Exception, e.IsTerminating);
else
DisplayError(new ApplicationException(string.Format("Got unknown exception: {0}",
e.ExceptionObject)), false);
}