private void PopulateServers(ConnectionParams defaultParams) { _cpList.Clear(); int serverIndex = -1; bool defaultIsInList = false; ConnectionParamsCollection cons = Connections; foreach (ConnectionParams cp in cons) { string key = ConnectionParams.PrepareConnKey(cp); if (cmbServers.Items.Contains(key)) continue; cmbServers.Items.Add(key); if (defaultParams != null && defaultParams.Server.ToLowerInvariant() == cp.Server.ToLowerInvariant()) { cmbServers.SelectedIndex = cmbServers.Items.Count - 1; serverIndex = cmbServers.SelectedIndex; defaultIsInList = true; } _cpList.Add(cp); } if (!defaultIsInList) { cmbServers.Items.Add(defaultParams.Server); cmbServers.SelectedIndex = cmbServers.Items.Count - 1; _cpList.Add(defaultParams); } }
private void PopulateServers() { _cpList.Clear(); ConnectionParamsCollection cons = Connections; foreach (ConnectionParams cp in cons) { //if (cmbServers.FindStringExact(cp.Server) != -1) if (cmbServers.FindStringExact(ConnectionParams.PrepareConnKey(cp)) != -1) { continue; } //cmbServers.Items.Add(cp.Server); cmbServers.Items.Add(ConnectionParams.PrepareConnKey(cp)); _cpList.Add(cp); } cmbServers.Text = "<Select Server>"; _currentServerIndex = -1; }
private void RenderConnectionInList(ConnectionParams cp) { string key = cp.PrepareConnKey(); string normalKey = key.Replace(((Char)29).ToString(), " as "); ListViewGroup group = null; if (_groups.ContainsKey(key)) { group = _groups[key]; } else { group = lv.Groups.Add(key, normalKey); _groups.Add(key, group); } ListViewItem item = new ListViewItem(normalKey, group); item.SubItems.Add(cp.Database); item.Tag = cp; lv.Items.Add(item); }