Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- //get the name of the enum from the combo box
- try
- {
- var newSettings = new ConnectionPreset();
- if (string.IsNullOrEmpty(textBoxServer.Text) ||
- string.IsNullOrEmpty(textBoxUser.Text) ||
- string.IsNullOrEmpty(textBoxDatabase.Text) ||
- string.IsNullOrEmpty(textBoxPassword.Text))
- {
- DialogResult result = MessageBox.Show("Not all settings are filled in, do you wish to retry, "
- + " or cancel and manually edit them later?",
- "Missing Settings", MessageBoxButtons.RetryCancel);
- if (result == DialogResult.Retry)
- {
- return;
- }
- else
- {
- goto leaveAndDoNothing;
- }
- }
- else
- {
- newSettings.DBServer = textBoxServer.Text;
- newSettings.DBName = textBoxDatabase.Text;
- newSettings.DBUserName = textBoxUser.Text;
- newSettings.DBUserPassword = textBoxPassword.Text;
- UpdatePropertiesConfig(installPath, newSettings);
- }
- }
- catch (Exception exc)
- {
- MessageBox.Show("There was an error while trying to set the application's "
- + "configuration. The application will have to be configured manually. "
- + exc.Message);
- }
- leaveAndDoNothing:
- Close();
- }
Add Comment
Please, Sign In to add comment