public ItemListingControl(ListingResult listingResult)
        {
            InitializeComponent();

            accountNameTextbox.Text   = listingResult.Listing.Account.Name;
            characterNameTextbox.Text = listingResult.Listing.Account.LastCharacterName;
            priceTextbox.Text         = listingResult.Listing.Price?.Amount + " " + listingResult.Listing.Price?.Currency;
            itemLevelTextbox.Text     = listingResult.Item.Ilvl.ToString();
            ageTextbox.Text           = GetHumanReadableTimeSpan(listingResult.Listing.Indexed);
        }
        public async Task <SimpleListingViewModel> CreateAsync(ListingResult listingResult, Item item, CancellationToken cancellationToken = default)
        {
            SimpleListingViewModel result = new SimpleListingViewModel();

            if (item is GemItem)
            {
                result = this.CreateGemItemListingViewModel(listingResult);
            }
            else if (item is EquippableItem || item is OrganItem)
            {
                result = this.CreateItemListingViewModelWithItemLevel(listingResult);
            }
            else if (item is FlaskItem)
            {
                result = this.CreateFlaskItemViewModel(listingResult);
            }

            await this.SetSimpleListingViewModelProperties(result, listingResult, cancellationToken).ConfigureAwait(false);

            return(result);
        }
예제 #3
0
        public async Task <ListingResult> GetListingsAsync(string accessToken, int limit)
        {
            var uri      = $"{ _settings.ListingsBaseUri}/listingsvc/v2/listings?limit={limit}&invested=false&biddable=true";
            var listings = new ListingResult();

            try
            {
                var headers = new Dictionary <string, string>
                {
                    ["Authorization"] = $"Bearer {accessToken}"
                };

                listings = await _client.Get <ListingResult>(uri, headers, _jsonSerializerSettings);
            }
            catch (Exception ex)
            {
                throw;
            }

            return(listings);
        }