Ensures server and database are up and running.
コード例 #1
0
 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();
     }
 }
コード例 #2
0
 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);
     }
 }