private void Save()
        {
            bool keepOpen = false;

            try
            {
                DatabaseConfigManager.Save(tbx_user.Text, tbx_password.Text, tbx_database.Text, tbx_address.Text);
            }
            catch
            {
                Form form = new DatabaseUnavailable();
                form.ShowDialog();
                switch (form.DialogResult)
                {
                case DialogResult.Abort:
                    Environment.Exit(0);
                    break;

                case DialogResult.Yes:
                    keepOpen = true;
                    break;
                }
            }
            if (!keepOpen)
            {
                this.Close();
            }
        }
Exemple #2
0
        private void MainMenu_Shown(object sender, EventArgs e)
        {
            try
            {
                Database.DatabaseHandler.Setup();
            }
            catch
            {
                Form errorForm = new DatabaseUnavailable();
                errorForm.ShowDialog();
                switch (errorForm.DialogResult)
                {
                case DialogResult.Abort:
                    Environment.Exit(0);
                    break;

                case DialogResult.Yes:
                    Form dbSettings = new DatabaseSettingsForm();
                    dbSettings.ShowDialog();
                    break;
                }
            }
        }