Guest User

Untitled

a guest
Jun 11th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. //get the name of the enum from the combo box
  4.  
  5. try
  6. {
  7. var newSettings = new ConnectionPreset();
  8.  
  9. if (string.IsNullOrEmpty(textBoxServer.Text) ||
  10. string.IsNullOrEmpty(textBoxUser.Text) ||
  11. string.IsNullOrEmpty(textBoxDatabase.Text) ||
  12. string.IsNullOrEmpty(textBoxPassword.Text))
  13. {
  14. DialogResult result = MessageBox.Show("Not all settings are filled in, do you wish to retry, "
  15. + " or cancel and manually edit them later?",
  16. "Missing Settings", MessageBoxButtons.RetryCancel);
  17. if (result == DialogResult.Retry)
  18. {
  19. return;
  20. }
  21. else
  22. {
  23. goto leaveAndDoNothing;
  24. }
  25. }
  26. else
  27. {
  28. newSettings.DBServer = textBoxServer.Text;
  29. newSettings.DBName = textBoxDatabase.Text;
  30. newSettings.DBUserName = textBoxUser.Text;
  31. newSettings.DBUserPassword = textBoxPassword.Text;
  32.  
  33. UpdatePropertiesConfig(installPath, newSettings);
  34. }
  35. }
  36. catch (Exception exc)
  37. {
  38. MessageBox.Show("There was an error while trying to set the application's "
  39. + "configuration. The application will have to be configured manually. "
  40. + exc.Message);
  41. }
  42. leaveAndDoNothing:
  43. Close();
  44. }
Add Comment
Please, Sign In to add comment