コード例 #1
0
        private void FillComboboxes(Loadout_Line line)
        {
            IEnumerable <Weapon> ieW = Weapon.GetAll();

            foreach (Weapon ob in ieW)
            {
                ComboBoxItem cbI = new ComboBoxItem();
                cbI.Content = ob.name;
                cbI.Tag     = ob.id;
                cbWeapon.Items.Add(cbI);
                if (line.weaponID == ob.id)
                {
                    cbWeapon.SelectedItem = cbI;
                }
            }
            IEnumerable <Ammunition> ieA = Ammunition.GetAll();

            foreach (Ammunition ob in ieA)
            {
                ComboBoxItem cbI = new ComboBoxItem();
                cbI.Content = ob.name;
                cbI.Tag     = ob.id;
                cbAmmunition.Items.Add(cbI);
                if (line.ammunitionID == ob.id)
                {
                    cbAmmunition.SelectedItem = cbI;
                }
            }
        }
コード例 #2
0
        private void FillComboboxes()
        {
            IEnumerable <Weapon> ieW = Weapon.GetAll();

            foreach (Weapon ob in ieW)
            {
                ComboBoxItem cbI = new ComboBoxItem();
                cbI.Content = ob.name;
                cbI.Tag     = ob.id;
                cbWeapon.Items.Add(cbI);
            }
            IEnumerable <Ammunition> ieA = Ammunition.GetAll();

            foreach (Ammunition ob in ieA)
            {
                ComboBoxItem cbI = new ComboBoxItem();
                cbI.Content = ob.name;
                cbI.Tag     = ob.id;
                cbAmmunition.Items.Add(cbI);
            }
        }