예제 #1
0
        public async Task <int> AddItem(int typeID)
        {
            EveItemModel n = await APIHelper.GetItem(typeID);

            ItemDic.Add(n.type_id, n);
            return(1);
        }
예제 #2
0
        //This method takes in an itemID makes a call to the server
        //and then returns an object containing item values
        //removed static...
        public async Task <EveItemModel> GetItem(int itemId)
        {
            var http     = new HttpClient();
            var url      = String.Format($"https://esi.evetech.net/latest/universe/types/{itemId}/?datasource=tranquility&language=en-us");
            var response = await http.GetAsync(url);

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

            EveItemModel anItem = new EveItemModel();

            anItem = (EveItemModel)JsonConvert.DeserializeObject <EveItemModel>(jsonString);


            return(anItem);
        }