private void btnSaveDbSettings_Click(object sender, EventArgs e) { var dbHost = txtDbHost.Text; var dbPort = 3306; Int32.TryParse(txtDbPort.Text, out dbPort); var dbName = txtDbName.Text; var dbUsername = txtDbUsername.Text; var dbPassword = Common.Sha1Hash(mtxtDbPassword.Text); if (server.CheckServerCredentials(new StorageCredentials(dbHost, dbPort, dbName, dbUsername, dbPassword))) { Settings.Default.DBHost = dbHost; Settings.Default.DBPort = dbPort; Settings.Default.DBName = dbName; Settings.Default.DBUsername = dbUsername; Settings.Default.DBPassword = dbPassword; Settings.Default.Save(); server.Start(); MessageBox.Show("Successfully updated server settings!"); } else { MessageBox.Show("Email or password is incorrect!"); } }
private void btnSaveDbSettings_Click(object sender, EventArgs e) { var dbHost = txtDbHost.Text; var dbPort = 3306; Int32.TryParse(txtDbPort.Text, out dbPort); var dbName = txtDbName.Text; var dbUsername = txtDbUsername.Text; var dbPassword = Common.Sha1Hash(mtxtDbPassword.Text); if (server.CheckServerCredentials(new StorageCredentials(dbHost, dbPort, dbName, dbUsername, dbPassword))) { Settings.Default.DBHost = dbHost; Settings.Default.DBPort = dbPort; Settings.Default.DBName = dbName; Settings.Default.DBUsername = dbUsername; Settings.Default.DBPassword = dbPassword; Settings.Default.Save(); //server.Start(); MessageBox.Show("Success!", "Successfully updated your server settings!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else { MessageBox.Show("Couldn't connect!", "Please check your settings...", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }