private void AddConnectionSpecToList(ConnectionParams connSpec) { ListViewGroup group = null; string key = ConnectionParams.PrepareConnKey(connSpec); string normalKey = key.Replace(((Char)29).ToString(), " as "); string serverName = connSpec.Server.Trim().ToLowerInvariant(); if (_groups.ContainsKey(serverName)) { group = _groups[serverName]; } else { group = new ListViewGroup(serverName, connSpec.Server); lvConnections.Groups.Add(group); _groups.Add(serverName, group); } ListViewItem item = new ListViewItem(normalKey, group); item.SubItems.Add(connSpec.Database); item.Tag = connSpec.ID; lvConnections.SelectedItems.Clear(); item.Selected = true; lvConnections.Items.Add(item); _connParams.Add(connSpec); InvalidateButtons(); }
private void PopulateDBConnections() { ListViewItem item = null; ListViewGroup group = null; _connParams = ConnectionParamsFactory.GetConnections(); lvConnections.Items.Clear(); string serverName = String.Empty; int cnt = 0; foreach (ConnectionParams connSpec in _connParams) { #if PERSONAL_EDITION cnt++; if (cnt > _maxPersonalEditionConnCnt) { lblPersonalEdLimit.Visible = true; lblPersonalEdLimit.Text = String.Format("Only {0} connections are listed.", _maxPersonalEditionConnCnt); lblPersonalEdLimit.ToolTipText = String.Format("Personal Edition does not support more than {0} saved connections.", _maxPersonalEditionConnCnt); break; } #endif string key = ConnectionParams.PrepareConnKey(connSpec); string normalKey = key.Replace(((Char)29).ToString(), " as "); serverName = connSpec.Server.Trim().ToLowerInvariant(); if (_groups.ContainsKey(serverName)) { group = _groups[serverName]; } else { group = new ListViewGroup(serverName, connSpec.Server); lvConnections.Groups.Add(group); _groups.Add(serverName, group); } item = new ListViewItem(normalKey, group); item.SubItems.Add(connSpec.Database); item.Tag = connSpec.ID; lvConnections.Items.Add(item); } if (_connParams.Count > 0) { lvConnections.Items[0].Selected = true; } InvalidateButtons(); }
public string PrepareConnKey() { return(ConnectionParams.PrepareConnKey(this)); }