private void FormCentralConnections_Load(object sender, EventArgs e) { _listConnectionGroups = ConnectionGroups.GetDeepCopy(); comboConnectionGroups.Items.Add("All"); comboConnectionGroups.Items.AddRange(_listConnectionGroups.Select(x => x.Description).ToArray()); comboConnectionGroups.SelectedIndex = 0; //Default to all. FillGrid(); }
///<summary>Refreshes _listConnectionGroups with the current cache (could have been updated) and then selects the conn group passed in.</summary> private void FillComboGroups(long connGroupNum) { _listConnectionGroups = ConnectionGroups.GetDeepCopy(); comboConnectionGroups.Items.Clear(); comboConnectionGroups.Items.Add("All"); comboConnectionGroups.SelectedIndex = 0; for (int i = 0; i < _listConnectionGroups.Count; i++) { comboConnectionGroups.Items.Add(_listConnectionGroups[i].Description); if (_listConnectionGroups[i].ConnectionGroupNum == connGroupNum) { comboConnectionGroups.SelectedIndex = i + 1; //0 is "All" } } }
private void FormCentralConnectionGroups_Load(object sender, EventArgs e) { _listCentralConnGroups = ConnectionGroups.GetDeepCopy(); long defaultConnGroupNum = PrefC.GetLong(PrefName.ConnGroupCEMT); comboConnectionGroup.Items.Clear(); comboConnectionGroup.Items.Add(Lan.g(this, "All")); comboConnectionGroup.SelectedIndex = 0; //Select all by default. //Fill in the list of conn groups and update the selected index of the combo box if needed. for (int i = 0; i < _listCentralConnGroups.Count; i++) { comboConnectionGroup.Items.Add(_listCentralConnGroups[i].Description); if (_listCentralConnGroups[i].ConnectionGroupNum == defaultConnGroupNum) { comboConnectionGroup.SelectedIndex = i + 1; } } FillGrid(); }