Пример #1
0
        public BulkQueryRequest(ParsedItem item, IStaticDataService staticDataService)
        {
            Exchange.Status.Option = StatusType.Online;

            Exchange.Want.Add(staticDataService.GetId(item.Name ?? item.TypeLine));
            Exchange.Have.Add("chaos"); // TODO: Add support for other currency types?
        }
Пример #2
0
        public BulkQueryRequest(Item item, IStaticDataService staticDataService)
        {
            Exchange.Status.Option = StatusType.Online;

            Exchange.Want.Add(staticDataService.GetId(item));
            Exchange.Have.Add("chaos");
        }
Пример #3
0
        public async Task UpdateQuery()
        {
            Results = new ObservableList <PriceItem>();

            if (Filters != null)
            {
                var saveSettings = false;
                foreach (var filter in Filters.SelectMany(x => x.Filters).Where(x => x.Type == nameof(StatFilter)))
                {
                    if (settings.Modifiers.Contains(filter.Id))
                    {
                        if (!filter.Enabled)
                        {
                            saveSettings = true;
                            settings.Modifiers.Remove(filter.Id);
                        }
                    }
                    else
                    {
                        if (filter.Enabled)
                        {
                            saveSettings = true;
                            settings.Modifiers.Add(filter.Id);
                        }
                    }
                }
                if (saveSettings)
                {
                    settings.Save();
                }
            }

            IsFetching = true;
            if (Item.Rarity == Rarity.Currency && staticDataService.GetId(Item) != null)
            {
                QueryResult = await tradeSearchService.SearchBulk(Item);
            }
            else
            {
                QueryResult = await tradeSearchService.Search(Item, GetFilters(), GetStats());
            }
            IsFetching = false;
            if (QueryResult == null)
            {
                IsError = true;
            }
            else if (QueryResult.Result.Any())
            {
                await LoadMoreData();
                await LoadMoreData();
            }

            UpdateCountString();
        }
Пример #4
0
        public async Task UpdateQuery()
        {
            ShowRefresh = false;
            Results     = new ObservableList <PriceItem>();

            if (Filters != null)
            {
                var saveSettings = false;

                var settingMods = Item.Category switch
                {
                    Category.Accessory => settings.AccessoryModifiers,
                    Category.Armour => settings.ArmourModifiers,
                    Category.Flask => settings.FlaskModifiers,
                    Category.Jewel => settings.JewelModifiers,
                    Category.Map => settings.MapModifiers,
                    Category.Weapon => settings.WeaponModifiers,
                    _ => new List <string>(),
                };

                foreach (var filter in Filters.SelectMany(x => x.Filters).Where(x => x.Type == nameof(StatFilter)))
                {
                    if (settingMods.Contains(filter.Id))
                    {
                        if (!filter.Enabled)
                        {
                            saveSettings = true;
                            settingMods.Remove(filter.Id);
                        }
                    }
                    else
                    {
                        if (filter.Enabled)
                        {
                            saveSettings = true;
                            settingMods.Add(filter.Id);
                        }
                    }
                }
                if (saveSettings)
                {
                    switch (Item.Category)
                    {
                    case Category.Accessory: settings.AccessoryModifiers = settingMods; break;

                    case Category.Armour: settings.ArmourModifiers = settingMods; break;

                    case Category.Flask: settings.FlaskModifiers = settingMods; break;

                    case Category.Jewel: settings.JewelModifiers = settingMods; break;

                    case Category.Map: settings.MapModifiers = settingMods; break;

                    case Category.Weapon: settings.WeaponModifiers = settingMods; break;
                    }
                    ;

                    settings.Save();
                }
            }

            IsFetching = true;
            if (Item.Rarity == Rarity.Currency && staticDataService.GetId(Item) != null)
            {
                QueryResult = await tradeSearchService.SearchBulk(Item);
            }
            else
            {
                QueryResult = await tradeSearchService.Search(Item, GetFilters(), GetStats());
            }
            IsFetching = false;
            if (QueryResult == null)
            {
                IsError = true;
            }
            else if (QueryResult.Result.Any())
            {
                await LoadMoreData();
                await LoadMoreData();
            }

            UpdateCountString();
        }