Exemplo n.º 1
0
        private void FillList()
        {
            switch (_action)
            {
            case fad3GearEditAction.addGearVariation:
                _List = Gears.AllGearVariationNames();
                foreach (var item in _List)
                {
                    listBox.Items.Add(item);
                }
                break;

            case fad3GearEditAction.addGearCode:
                foreach (var item in Gears.GearCodesByClass(_GearClassGuid))
                {
                    listBox.Items.Add(item);
                }

                labelCode.Text = Gears.GearLetterFromGearClass(_GearClassGuid);
                break;

            case fad3GearEditAction.addAOI:
            case fad3GearEditAction.addLocalName:
                TargetArea targetArea = new TargetArea();

                ((ComboBox)comboBox).With(o =>
                {
                    if (_action == fad3GearEditAction.addAOI)
                    {
                        foreach (var item in targetArea.TargetAreas)
                        {
                            comboBox.Items.Add(item);
                        }
                    }
                    else
                    {
                        foreach (var item in Gears.GearLocalNames)
                        {
                            comboBox.Items.Add(item);
                        }
                    }

                    o.DisplayMember      = "Value";
                    o.ValueMember        = "Key";
                    o.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                    o.AutoCompleteSource = AutoCompleteSource.ListItems;
                });

                for (int i = 0; i < comboBox.Items.Count; i++)
                {
                    comboList.Add(((KeyValuePair <string, string>)comboBox.Items[i]).Value);
                }

                break;
            }
        }