Example #1
0
        private void LoadDataFromWebsite(string sEpicName)
        {
            LoadWeaponWebsite myWeapons = new LoadWeaponWebsite(sEpicName);

            dgvInventory.ItemsSource = myWeapons.GetAllRangeWeapon();
        }
Example #2
0
        private void SelectWeaponAndPerks()
        {
            LoadWeaponWebsite weaponWebsite = (LoadWeaponWebsite)dgvInventory.SelectedItem;

            List <Perk> listPerkCommon    = new Perk(PerkQuality.Common).PicList();
            List <Perk> listPerkRare      = new Perk(PerkQuality.Rare).PicList();
            List <Perk> listPerkLegendary = new Perk(PerkQuality.Legendary).PicList();

            List <PerkLvlPicker> listcobLvLX = new List <PerkLvlPicker>();

            listcobLvLX.Add(cobLvL1);
            listcobLvLX.Add(cobLvL2);
            listcobLvLX.Add(cobLvL3);
            listcobLvLX.Add(cobLvL4);
            listcobLvLX.Add(cobLvL5);
            List <ComboBox> listcobPerkX = new List <ComboBox>();

            listcobPerkX.Add(cobPerk1);
            listcobPerkX.Add(cobPerk2);
            listcobPerkX.Add(cobPerk3);
            listcobPerkX.Add(cobPerk4);
            listcobPerkX.Add(cobPerk5);

            //Selected Weapon
            string   sWeaponName = weaponWebsite.sWeapon;
            DataView dvWeapon    = (DataView)cobWeapon.ItemsSource;

            dvWeapon.Sort           = "Name";
            cobWeapon.SelectedIndex = dvWeapon.Find(sWeaponName);

            string[] asPerks = new string[5];
            asPerks[0] = weaponWebsite.sPerk1;
            asPerks[1] = weaponWebsite.sPerk2;
            asPerks[2] = weaponWebsite.sPerk3;
            asPerks[3] = weaponWebsite.sPerk4;
            asPerks[4] = weaponWebsite.sPerk5;

            for (int iPerkWeapon = 0; iPerkWeapon < 5; iPerkWeapon++)
            {
                string sPerk = asPerks[iPerkWeapon];
                if (!sPerk.Equals(""))
                {
                    for (int i = 0; i < listPerkCommon.Count; i++)
                    {
                        if (listPerkCommon[i].Name.Equals(sPerk))
                        {
                            listcobLvLX[iPerkWeapon].SelectedColor  = Colors.LightGray;
                            listcobPerkX[iPerkWeapon].SelectedIndex = i;
                        }
                    }
                    for (int i = 0; i < listPerkRare.Count; i++)
                    {
                        if (listPerkRare[i].Name.Equals(sPerk))
                        {
                            listcobLvLX[iPerkWeapon].SelectedColor  = Colors.DodgerBlue;
                            listcobPerkX[iPerkWeapon].SelectedIndex = i;
                        }
                    }
                    for (int i = 0; i < listPerkLegendary.Count; i++)
                    {
                        if (listPerkLegendary[i].Name.Equals(sPerk))
                        {
                            listcobLvLX[iPerkWeapon].SelectedColor  = Colors.DarkOrange;
                            listcobPerkX[iPerkWeapon].SelectedIndex = i;
                        }
                    }
                }
                else
                {
                    listcobLvLX[iPerkWeapon].SelectedColor  = Colors.LightGray;
                    listcobPerkX[iPerkWeapon].SelectedIndex = 0;
                }
            }
        }