private async Task TestDatabaseConnectionAsync() { // Test connection to database. DatabaseHandler db = new DatabaseHandler(); try { await db.EnsureAvailableAsync(); } catch (Exception ex) { string ErrorMessage = "Cannot connect to database.\r\n" + ex.Message; MessageBox.Show(Main, ErrorMessage, "Natural Grounding Player"); App.Current.Shutdown(); } }
private void HandleFatalException(Exception e) { string ErrorMessage = "An unhandled exception has occured. Do you want to see the error details? You may send this report by email to [email protected]"; ErrorMessage += Environment.NewLine + Environment.NewLine + e.Message; if (MessageBox.Show(ErrorMessage, "Unhandled Exception", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { DatabaseHandler Handler = new DatabaseHandler(); Handler.LogException(e); } }