public async void GetData() { restService = new RestService(); RootObjectLag rootObject = new RootObjectLag(); lagerlist.RowHeight = 60; rootObject = await restService.RefreshLagerbestandAsync(); lagerlist.ItemsSource = rootObject.lagerbestand; lagers = rootObject.lagerbestand; }
public async void GetJson() { restService = new RestService(); RootObject rootObject = new RootObject(); RootObjectLag objectLag = new RootObjectLag(); try { rootObject = await restService.RefreshDataAsync(); produkts = rootObject.produkt; proBezList = produkts.Select(p => p.pro_bezeichnung).ToList(); picker_pro.ItemsSource = proBezList; objectLag = await restService.RefreshLagerbestandAsync(); lagers = objectLag.lagerbestand; } catch (Exception ex) { Debug.WriteLine(@" ERROR {0}", ex.Message); } }
public async Task <RootObjectLag> RefreshLagerbestandAsync() { Lagers = new RootObjectLag(); var uri = new Uri(string.Format(Constants.LagerbestandRead, string.Empty)); try { var response = await client.GetAsync(uri); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); Lagers = JsonConvert.DeserializeObject <RootObjectLag>(content); } } catch (Exception ex) { Debug.WriteLine(@" ERROR {0}", ex.Message); } return(Lagers); }