public static ConnectionParams CreateConnection(bool canUseTemplates) { frmConnectionParams frm = new frmConnectionParams(false, false, canUseTemplates); DialogResult dlgRes = frm.ShowDialog(); if (dlgRes != DialogResult.OK) { return(null); } return(frm.GetCurrentConnectionSpec()); }
private void AddNewConnectionSpec() { #if PERSONAL_EDITION if (lvConnections.Items.Count >= _maxPersonalEditionConnCnt) { throw new PersonalEditionLimitation(String.Format("Personal Edition does not support more than {0} saved connections.", _maxPersonalEditionConnCnt)); } #endif frmConnectionParams frm = new frmConnectionParams(); if (frm.ShowDialog() == DialogResult.OK) { AddConnectionSpecToList(frm.GetCurrentConnectionSpec()); ConnectionParamsFactory.Save(_connParams); InvalidateButtons(); } }
private void EditSelectedConnectionSpec() { if (lvConnections.SelectedItems.Count == 0) { return; } frmConnectionParams frm = new frmConnectionParams(this.SelectedDataSource, true, false); if (frm.ShowDialog() == DialogResult.OK) { _connParams.Delete(this.SelectedDataSource); lvConnections.Items.Remove(lvConnections.SelectedItems[0]); AddConnectionSpecToList(frm.GetCurrentConnectionSpec()); ConnectionParamsFactory.Save(_connParams); InvalidateButtons(); } }