Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sectionHeading"></param>
        ///
        /// <param name="interfaceObj"></param>
        public List <CListBoxWrapper> DisplayForm(string sectionHeading, Type typeObj,
                                                  CListBoxWrapper currentSelection, bool bHide)
        {
            ArrayList              allObjs;
            CObjectFactory         factory = new CObjectFactory();
            CListBoxWrapper        oWrap;
            List <CListBoxWrapper> allSelected = new List <CListBoxWrapper>();

            this.Text = "Make Selection";

            groupBoxMain.Text = sectionHeading;

            allObjs = factory.GetObjects(typeObj, Application.StartupPath);

            if (allObjs == null)
            {
                return(allSelected);                 //Count will be 0
            }
            foreach (Object o in allObjs)
            {
                oWrap         = new CListBoxWrapper();
                oWrap.objMain = (IRootInterface)o;
                oWrap.index   = listBoxMain.Items.Count;
                listBoxMain.Items.Add(oWrap);
            }

            //Set Current Selection
            if (currentSelection != null)
            {
                if (currentSelection.index < listBoxMain.Items.Count)
                {
                    listBoxMain.SelectedIndex = currentSelection.index;
                    listBoxMain.SetItemChecked(listBoxMain.SelectedIndex, true);
                }
            }

            if (!bHide)
            {
                this.ShowDialog();
            }

            //Return all Selected

            foreach (CListBoxWrapper tmpO in listBoxMain.CheckedItems)
            {
                allSelected.Add(tmpO);
            }

            return(allSelected);
        }
Example #2
0
        /// <summary>
        /// Put all Plug Ins in specified List boxes
        /// </summary>
        /// <param name="typeObj"></param>
        /// <param name="listBox"></param>
        private void ListPlugIns(Type typeObj, CheckedListBox listBox)
        {
            ArrayList      allObjs;
            CObjectFactory factory = new CObjectFactory();
            //IRootInterface oTmp;
            //String sTmp;
            CListBoxWrapper oWrap;

            allObjs = factory.GetObjects(typeObj, Application.StartupPath);
            AddRunTimeMessage("Add PlugIns", factory.errorMessages);

            if (allObjs == null)
            {
                return;
            }

            foreach (Object o in allObjs)
            {
                oWrap         = new CListBoxWrapper();
                oWrap.objMain = (IRootInterface)o;
                oWrap.index   = listBox.Items.Count;
                listBox.Items.Add(oWrap);
            }
        }