private void CleanUp() { var sqlUtilities = new SqLiteUtilities(dbPath); try { sqlUtilities.DeleteFile(); sqlUtilities.OpenConnection(); sqlUtilities.CreateTable(); sqlUtilities.CloseConnection(); using (var fUtilities = new FileUtilities(dbPath)) { fUtilities.DeleteFile(); fUtilities.CreateFile(); fUtilities.CloseFile(); } } catch (Exception ex) { var dlgException = new UIAlertView("Error", string.Format("An error has occurred: " + ex.Message), new UIAlertViewDelegate(), "OK"); dlgException.Show(); return; } var dlgAlert = new UIAlertView("Cleanup and Prepare for Tests Successful", string.Format("Completed test setup"), new UIAlertViewDelegate(), "OK"); dlgAlert.Show(); return; }
private void CleanUp() { var directory = DependencyService.Get<IDirectoryLocation>().Directory; var sqlUtilities = new SqLiteUtilities(directory); try { sqlUtilities.DeleteFile(); sqlUtilities.OpenConnection(); sqlUtilities.CreateTable(); sqlUtilities.CloseConnection(); using (var fUtilities = new FileUtilities(directory)) { fUtilities.DeleteFile(); fUtilities.CreateFile(); fUtilities.CloseFile(); } } catch (Exception ex) { if (DisplayMessage != null) DisplayMessage(this, new DisplayMessageEventArgs( "Error", string.Format("An error has occurred: {0}", ex.Message))); return; } if (DisplayMessage != null) DisplayMessage(this, new DisplayMessageEventArgs( "Cleanup and Prepare for Tests Successful", "Completed test setup")); return; }