Exemple #1
0
 private async void Window_Initialized(object sender, EventArgs e)
 {
     foreach (var item in await Riot.GetSummonerSpellsAsync())
     {
         if (SpellWhitelist.Any(o => o == item.ID))
         {
             List.Items.Add(new IHateWpf(item, item == SelectedSpell));
         }
     }
 }
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Don't regenerate controls if coming back from another page
            if (Picks.Count > 0)
            {
                return;
            }

            GenerateControls();

            foreach (var item in Actuator.RuneProviders)
            {
                if (!(item is ClientProvider))
                {
                    if (item.Supports(Provider.Options.RunePages))
                    {
                        Providers.Items.Add(item);
                    }

                    if (item.Supports(Provider.Options.ItemSets))
                    {
                        ItemProviders.Items.Add(item);
                    }

                    if (item.Supports(Provider.Options.SkillOrder))
                    {
                        SkillProviders.Items.Add(item);
                    }


                    if (item.Name == Config.LockLoadProvider)
                    {
                        Providers.SelectedItem = item;
                    }

                    if (item.Name == Config.ItemSetProvider)
                    {
                        ItemProviders.SelectedItem = item;
                    }

                    if (item.Name == Config.SkillOrderProvider)
                    {
                        SkillProviders.SelectedItem = item;
                    }
                }
            }

            int i = 0;

            foreach (var item in Config.ChampionsToPick)
            {
                Picks[i++].Champion = Riot.GetChampion(item.Value);
            }

            i = 0;
            foreach (var item in Config.ChampionsToBan)
            {
                Bans[i++].Champion = Riot.GetChampion(item.Value);
            }

            var spells = await Riot.GetSummonerSpellsAsync();

            i = 0;
            foreach (var item in Config.SpellsToPick)
            {
                Spells[i++].Spell = spells.SingleOrDefault(o => o.ID == item.Value[0]);
                Spells[i++].Spell = spells.SingleOrDefault(o => o.ID == item.Value[1]);
            }
        }