コード例 #1
0
        private void CleanUp()
        {
            var sqlUtilities = new SqLiteUtilitiesAlt(this);

            try
            {
                sqlUtilities.OpenConnection();
                sqlUtilities.CreateTable();
                sqlUtilities.CloseConnection();

                using (var fUtilities = new FileUtilities(directory))
                {
                    fUtilities.DeleteFile();

                    fUtilities.CreateFile();

                    fUtilities.CloseFile();
                }
            }
            catch (Exception ex)
            {
                var dlgException = new AlertDialog.Builder(this);
                dlgException.SetMessage("An error has occurred: " + ex.Message);
                dlgException.SetTitle("Error");
                dlgException.SetPositiveButton("OK", (sender, args) => { });
                dlgException.SetCancelable(true);
                dlgException.Create().Show();
                return;
            }

            var dlgAlert = new AlertDialog.Builder(this);

            dlgAlert.SetMessage("Completed test setup");
            dlgAlert.SetTitle("Cleanup and Prepare for Tests Successful");
            dlgAlert.SetPositiveButton("OK", (sender, args) => { });
            dlgAlert.SetCancelable(true);
            dlgAlert.Create().Show();
            return;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }