/// <summary> /// This method assumes all of the Find and UsedBy items are included in the fcfList. /// </summary> /// <param name="mediator"></param> /// <param name="fcfList"></param> /// <param name="startingItem"></param> internal void SetupDlg(Mediator mediator, List<FindComboFillerBase> fcfList, FindComboFillerBase startingItem) { if (mediator == null) throw new ArgumentException("No Mediator."); if (fcfList == null) throw new ArgumentException("No items found."); if (fcfList.Count < 1) throw new ArgumentException("There has to be at least one item."); foreach (FindComboFillerBase fcf in fcfList) { if (fcf.List_UBF.Count == 0) throw new ArgumentException("No sub-items found."); } if (startingItem != null && !fcfList.Contains(startingItem)) throw new ArgumentException("'startingItem' is not in the 'fcfList' list."); m_mediator = mediator; m_cbFind.BeginUpdate(); m_cbFind.Items.Clear(); m_cbFind.Items.AddRange(fcfList.ToArray()); m_cbFind.EndUpdate(); m_cbFind.SelectedItem = startingItem; m_mediator.BroadcastPendingItems(); }
/// <summary> /// This is the primary combo box. /// When an item is selected, then the secondary combo box can be /// filled with approriate items. /// With the selected itme here, we can also populate the /// left side control (the one below the combo box). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void m_cbFind_SelectedIndexChanged(object sender, EventArgs e) { Cursor oldState = FindForm().Cursor; m_selectedFinder = null; FindForm().Cursor = Cursors.WaitCursor; FindComboFillerBase fcf = m_cbFind.SelectedItem as FindComboFillerBase; m_cbUsedBy.BeginUpdate(); m_cbUsedBy.Items.Clear(); m_cbUsedBy.Items.AddRange(fcf.List_UBF.ToArray()); m_cbUsedBy.EndUpdate(); fcf.LoadList(m_mediator, m_splitContainer.Panel1); if (m_cbUsedBy.Items.Count > 0) { m_cbUsedBy.SelectedIndex = 0; } else { m_cbUsedBy.SelectedItem = null; } FindForm().Cursor = oldState; }
/// <summary> /// This method assumes all of the Find and UsedBy items are included in the fcfList. /// </summary> /// <param name="mediator"></param> /// <param name="fcfList"></param> /// <param name="startingItem"></param> internal void SetupDlg(Mediator mediator, List <FindComboFillerBase> fcfList, FindComboFillerBase startingItem) { if (mediator == null) { throw new ArgumentException("No Mediator."); } if (fcfList == null) { throw new ArgumentException("No items found."); } if (fcfList.Count < 1) { throw new ArgumentException("There has to be at least one item."); } foreach (FindComboFillerBase fcf in fcfList) { if (fcf.List_UBF.Count == 0) { throw new ArgumentException("No sub-items found."); } } if (startingItem != null && !fcfList.Contains(startingItem)) { throw new ArgumentException("'startingItem' is not in the 'fcfList' list."); } m_mediator = mediator; m_cbFind.BeginUpdate(); m_cbFind.Items.Clear(); m_cbFind.Items.AddRange(fcfList.ToArray()); m_cbFind.EndUpdate(); m_cbFind.SelectedItem = startingItem; m_mediator.BroadcastPendingItems(); }