Esempio n. 1
0
        /// <summary>
        /// Compact the database.
        /// </summary>
        private void CompactDatabaseButton_Click(object sender, EventArgs e)
        {
            if (GetConfirmation("This process will restructure the database and could take some time \n"
                                + " if the database is large.\n" + " Proceed?"))
            {
                try {
                    // Do not allow the form to be closed.
                    allowClose = false;

                    // Show progress bar.
                    progressBar.Visible = true;

                    DatabaseWorker.CompactDatabase();

                    // Hide progress bar.
                    progressBar.Visible = false;

                    // Allow the form to be closed.
                    allowClose = true;

                    MessageBoxAdv.Show(this, "Successfully compacted the database.", "Success");
                }
                catch (Exception) {
                    MessageBoxAdv.Show(this, "Failed to compact the database.", "Failed");

                    // Hide progress bar.
                    progressBar.Visible = false;

                    // Allow the form to be closed.
                    allowClose = true;
                }
            }
        }
Esempio n. 2
0
 private void compactDatabaseButton_Click(object sender, EventArgs e)
 {
     DatabaseWorker.CompactDatabase();
 }