Ejemplo n.º 1
0
        /// <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();
        }