/// <summary> /// Call this before ShowDialog to initialise the dialog with entry values to be edited /// </summary> /// <param name="BranchLocation">The path to the active branch</param> /// <param name="Index">The index of the favourite to be edited</param> /// <param name="LocalSettings">A reference to the local settings object used to persist personal preferences</param> public void InitializeDialog(string BranchLocation, int Index, SettingsDictionary LocalSettings) { BuildConfiguration dbCfg = new BuildConfiguration(BranchLocation, LocalSettings); string dbms, dbName, port, password, location, version; bool isBlank; dbCfg.GetStoredConfiguration(Index, out dbms, out dbName, out port, out password, out isBlank, out location, out version); cboDBMS.SelectedIndex = BuildConfiguration.GetDBMSIndex(dbms); txtDBName.Text = dbName; txtPort.Text = port; txtPassword.Text = password; chkBlankPW.Checked = isBlank; txtLocation.Text = location; if (String.Compare(dbms, "postgresql", true) == 0) { SetPostgreSQLVersionIndex(version); } else { cboVersion.SelectedIndex = 0; } SetEnabledStates(); }
private void btnOK_Click(object sender, EventArgs e) { string version = cboVersion.Items[cboVersion.SelectedIndex].ToString(); if (version == BuildConfiguration.DefaultString) { version = String.Empty; } if (version == "9.0") { version = String.Empty; // applies to PostgreSQL } string location = txtLocation.Text; location = location.Replace('\\', '/'); ExitData = BuildConfiguration.MakeConfigString( (cboDBMS.SelectedIndex == 0) ? String.Empty : BuildConfiguration.Systems[BuildConfiguration.GetDBMSIndex(cboDBMS.Items[cboDBMS.SelectedIndex].ToString())], txtDBName.Text, txtPort.Text, txtPassword.Text, chkBlankPW.Checked, location, version); DialogResult = DialogResult.OK; Close(); }