コード例 #1
0
        private void SaveLargeFile()
        {
            int maxValue = 999;

            try
            {
                using (var utilities = new FileUtilities(dbPath))
                {
                    utilities.OpenFile();

                    for (int i = 0; i <= maxValue; i++)
                    {
                        utilities.WriteLineToFile("Writing line to file at index: " + i);
                    }
                    utilities.CloseFile();
                }
            }
            catch (Exception ex)
            {
                var dlgException = new UIAlertView("Error",
                                                   string.Format("An error has occurred adding lines to file: " + ex.Message),
                                                   new UIAlertViewDelegate(),
                                                   "OK");
                dlgException.Show();
                return;
            }

            var dlgAlert = new UIAlertView("Success",
                                           string.Format("All lines written to filee"),
                                           new UIAlertViewDelegate(),
                                           "OK");

            dlgAlert.Show();
            return;
        }
コード例 #2
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;
        }
コード例 #3
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;
        }
コード例 #4
0
        private void SaveLargeFile()
        {
            int maxValue = 999;
            var directory = DependencyService.Get<IDirectoryLocation>().Directory;

            try
            {
                using (var utilities = new FileUtilities(directory))
                {
                    utilities.OpenFile();

                    for (int i = 0; i <= maxValue; i++)
                    {
                        utilities.WriteLineToFile("Writing line to file at index: " + i);
                    }
                    utilities.CloseFile();
                }
            }
            catch (Exception ex)
            {
                if (DisplayMessage != null)
                {
                    DisplayMessage(this, new DisplayMessageEventArgs(
                        "Error",
                        string.Format("An error has occurred adding lines to file: {0}", ex.Message)));
                }
                return;
            }

            if (DisplayMessage != null)
            {
                DisplayMessage(this, new DisplayMessageEventArgs(
                    "Success",
                    "All lines written to file"));
            }
            return;
        }
コード例 #5
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;
        }
コード例 #6
0
        private void SaveLargeFile()
        {
            int maxValue = 999;

            try
            {
                using (var utilities = new FileUtilities(directory))
                {
                    utilities.OpenFile();

                    for (int i = 0; i <= maxValue; i++)
                    {
                        utilities.WriteLineToFile("Writing line to file at index: " + i);
                    }
                    utilities.CloseFile();
                }
            }
            catch (Exception ex)
            {
                AlertDialog.Builder dlgException = new AlertDialog.Builder(this);
                dlgException.SetMessage("An error has occurred adding lines to file: " + ex.Message);
                dlgException.SetTitle("Error");
                dlgException.SetPositiveButton("OK", (sender, args) => { });
                dlgException.SetCancelable(true);
                dlgException.Create().Show();
                return;
            }

            AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
            dlgAlert.SetMessage("All lines written to file");
            dlgAlert.SetTitle("Success");
            dlgAlert.SetPositiveButton("OK", (sender, args) => { });
            dlgAlert.SetCancelable(true);
            dlgAlert.Create().Show();
            return;
        }