/// <summary> /// Creates and adds new rows to dgBuyers based on <see cref="ListingsDTO"/> Sells list /// </summary> private void ShowSellers(ListingsDTO listings) { dgSellers.Rows.Clear(); if (listings != null && listings.Sells != null) { for (int i = 0; cbSellers.Checked ? (i < listings.Sells.Length && i < 10) : i < listings.Sells.Length; i++) { var sellListing = listings.Sells[i]; dgSellers.Rows.Add(sellListing.Unit_Price, sellListing.Quantity, sellListing.Listings); } } }
/// <summary> /// Creates and adds new rows to dgBuyers based on <see cref="ListingsDTO"/> BUYS list /// </summary> private void ShowBuyers(ListingsDTO listings) { dgBuyers.Rows.Clear(); if (listings != null && listings.Buys != null) { for (int i = 0; cbBuyers.Checked ? (i < listings.Buys.Length && i < 10) : i < listings.Buys.Length; i++) { var buyListing = listings.Buys[i]; dgBuyers.Rows.Add(buyListing.Unit_Price, buyListing.Quantity, buyListing.Listings); } } }
/// <summary> /// Gets the object tp listings. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public ListingsDTO GetItemListings(ItemDTO item) { ListingsDTO data = null; try { var json = GetGW2AppData("/commerce/listings/" + item.Id); //sample request: https://api.guildwars2.com/v2/commerce/listings/19684 page and page_size data = ConvertFromJSONToObject <ListingsDTO>(json); item.Listings = data; } catch (Exception ex) { Log.LogError("Error: GetObjectTPListings:" + ex.Message); return(null); } return(data); }