示例#1
0
        public async Task Load()
        {
            using (var client = new HttpClient())
            {
                URLBuilder url = new URLBuilder(_filter, controler);
                url.URL += "&ShowMyOffers=true";
                var request = new HttpRequestMessage()
                {
                    RequestUri = new Uri(url.URL),
                    Method     = HttpMethod.Get
                };
                request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", _authenticationUser.UserId.ToString(), _authenticationUser.Password))));
                var response = await client.SendAsync(request);

                var contents = await response.Content.ReadAsStringAsync();

                List <SellOfferDto> result = JsonConvert.DeserializeObject <List <SellOfferDto> >(contents);
                SellOffers.Clear();
                foreach (SellOfferDto bo in result)
                {
                    SellOfferWrapper boffer = bo.createSellOffer();
                    SellOffers.Add(boffer);
                }
            }
            await RefreshProducts();
        }
示例#2
0
        public override void ParseFromNetworkMessage(NetworkMessage message)
        {
            TypeId = message.ReadUInt16();

            BuyOffers.Capacity = (int)message.ReadUInt32();
            for (uint i = 0; i < BuyOffers.Capacity; ++i)
            {
                BuyOffers.Add(message.ReadMarketOffer((int)MarketOfferType.Buy, TypeId));
            }

            SellOffers.Capacity = (int)message.ReadUInt32();
            for (uint i = 0; i < SellOffers.Capacity; ++i)
            {
                SellOffers.Add(message.ReadMarketOffer((int)MarketOfferType.Sell, TypeId));
            }
        }