コード例 #1
0
        private async Task GetCategories(Boolean init)
        {
            String url = "http://api.meetup.com/2/categories.json/?page=40&key={0}";

            url = String.Format(url, token);

            using (HttpClient http = new HttpClient())
            {
                String str = await http.GetStringAsync(url);

                var categories = JsonConvert.DeserializeObject <MeetupCategory>(str);

                foreach (var category in categories.results)
                {
                    CategoryOptions.Add(category);
                }

                CategoryOptions.Insert(0, new Category {
                    name = "All"
                });

                if (init)
                {
                    Category = CategoryOptions.First();
                }
            }
        }
コード例 #2
0
        private async Task Initialize()
        {
            Item = await parserService.ParseItem(nativeClipboard.LastCopiedText);

            if (Item == null)
            {
                IsError = true;
                return;
            }

            CategoryOptions.Add(Item.TypeLine, null);
            // CategoryOptions.Add(PriceResources.Class_Any, null);
            if (Item.Category == Category.Weapon)
            {
                CategoryOptions.Add(PriceResources.Class_Weapon, "weapon");
                CategoryOptions.Add(PriceResources.Class_WeaponOne, "weapon.one");
                CategoryOptions.Add(PriceResources.Class_WeaponOneMelee, "weapon.onemelee");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoMelee, "weapon.twomelee");
                CategoryOptions.Add(PriceResources.Class_WeaponBow, "weapon.bow");
                CategoryOptions.Add(PriceResources.Class_WeaponClaw, "weapon.claw");
                CategoryOptions.Add(PriceResources.Class_WeaponDagger, "weapon.dagger");
                CategoryOptions.Add(PriceResources.Class_WeaponRuneDagger, "weapon.runedagger");
                CategoryOptions.Add(PriceResources.Class_WeaponOneAxe, "weapon.oneaxe");
                CategoryOptions.Add(PriceResources.Class_WeaponOneMace, "weapon.onemace");
                CategoryOptions.Add(PriceResources.Class_WeaponOneSword, "weapon.onesword");
                CategoryOptions.Add(PriceResources.Class_WeaponSceptre, "weapon.sceptre");
                CategoryOptions.Add(PriceResources.Class_WeaponStaff, "weapon.staff");
                CategoryOptions.Add(PriceResources.Class_WeaponWarstaff, "weapon.warstaff");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoAxe, "weapon.twoaxe");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoMace, "weapon.twomace");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoSword, "weapon.twosword");
                CategoryOptions.Add(PriceResources.Class_WeaponWand, "weapon.wand");
                CategoryOptions.Add(PriceResources.Class_WeaponRod, "weapon.rod");
            }

            if (Item.Category == Category.Armour)
            {
                CategoryOptions.Add(PriceResources.Class_Armour, "armour");
                CategoryOptions.Add(PriceResources.Class_ArmourChest, "armour.chest");
                CategoryOptions.Add(PriceResources.Class_ArmourBoots, "armour.boots");
                CategoryOptions.Add(PriceResources.Class_ArmourGloves, "armour.gloves");
                CategoryOptions.Add(PriceResources.Class_ArmourHelmet, "armour.helmet");
                CategoryOptions.Add(PriceResources.Class_ArmourShield, "armour.shield");
                CategoryOptions.Add(PriceResources.Class_ArmourQuiver, "armour.quiver");
            }

            if (Item.Category == Category.Accessory)
            {
                CategoryOptions.Add(PriceResources.Class_Accessory, "accessory");
                CategoryOptions.Add(PriceResources.Class_AccessoryAmulet, "accessory.amulet");
                CategoryOptions.Add(PriceResources.Class_AccessoryBelt, "accessory.belt");
                CategoryOptions.Add(PriceResources.Class_AccessoryRing, "accessory.ring");
            }

            if (Item.Category == Category.Gem)
            {
                CategoryOptions.Add(PriceResources.Class_Gem, "gem");
                CategoryOptions.Add(PriceResources.Class_GemActive, "gem.activegem");
                CategoryOptions.Add(PriceResources.Class_GemSupport, "gem.supportgem");
                CategoryOptions.Add(PriceResources.Class_GemAwakenedSupport, "gem.supportgemplus");
            }

            if (Item.Category == Category.Jewel)
            {
                CategoryOptions.Add(PriceResources.Class_Jewel, "jewel");
                CategoryOptions.Add(PriceResources.Class_JewelBase, "jewel.base");
                CategoryOptions.Add(PriceResources.Class_JewelAbyss, "jewel.abyss");
                CategoryOptions.Add(PriceResources.Class_JewelCluster, "jewel.cluster");
            }

            if (Item.Category == Category.Flask)
            {
                CategoryOptions.Add(PriceResources.Class_Flask, "flask");
            }

            if (Item.Category == Category.Map)
            {
                CategoryOptions.Add(PriceResources.Class_Map, "map");
                CategoryOptions.Add(PriceResources.Class_MapFragment, "map.fragment");
                CategoryOptions.Add(PriceResources.Class_MapScarab, "map.scarab");
            }

            if (Item.Category == Category.Watchstone)
            {
                CategoryOptions.Add(PriceResources.Class_Watchstone, "watchstone");
            }

            if (Item.Category == Category.Leaguestone)
            {
                CategoryOptions.Add(PriceResources.Class_Leaguestone, "leaguestone");
            }

            if (Item.Category == Category.Prophecy)
            {
                CategoryOptions.Add(PriceResources.Class_Prophecy, "prophecy");
            }

            if (Item.Category == Category.DivinationCard)
            {
                CategoryOptions.Add(PriceResources.Class_Card, "card");
            }

            if (Item.Category == Category.ItemisedMonster)
            {
                CategoryOptions.Add(PriceResources.Class_MonsterBeast, "monster.beast");
                CategoryOptions.Add(PriceResources.Class_MonsterSample, "monster.sample");
            }

            if (Item.Category == Category.Currency)
            {
                CategoryOptions.Add(PriceResources.Class_Currency, "currency");
                CategoryOptions.Add(PriceResources.Class_CurrencyPiece, "currency.piece");
                CategoryOptions.Add(PriceResources.Class_CurrencyResonator, "currency.resonator");
                CategoryOptions.Add(PriceResources.Class_CurrencyFossil, "currency.fossil");
                CategoryOptions.Add(PriceResources.Class_CurrencyIncubator, "currency.incubator");
            }

            SelectedCategory = (await itemCategoryService.Get(Item.TypeLine))?.Category;
            if (!CategoryOptions.Values.Any(x => x == SelectedCategory))
            {
                SelectedCategory = null;
            }

            ShowCategory = (Item?.Rarity == Rarity.Rare || Item?.Rarity == Rarity.Magic || Item?.Rarity == Rarity.Normal) && CategoryOptions.Count > 1;

            InitializeFilters();

            await UpdateQuery();

            GetPoeNinjaPrice();

            if (settings.EnablePricePrediction)
            {
                _ = GetPredictionPrice();
            }
        }