Exemplo n.º 1
0
        private void btConfirmSelection_Click(object sender, EventArgs e)
        {
            if ((databaseFolderPath == null) || (tempFolderPath == null))
            {
                MessageBox.Show("Please select the database and temporary folders, respectively.",
                                "Folders Selection Required",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            if (tempFolderPath.EndsWith(Path.DirectorySeparatorChar.ToString()) == true)
            {
                MessageBox.Show("The temporary folder must not reside on the root of a drive.",
                                "Folders Selection Required",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            if (databaseFolderPath == tempFolderPath)
            {
                MessageBox.Show("The database folder and temporary folder must be different.",
                                "Folders Selection Required",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            RegistryHandler.CommitSettingsToRegistry(databaseFolderPath, tempFolderPath);
            this.FormClosing -= OptionsForm_FormClosing;
            this.Close();
        }