Beispiel #1
0
        public async void GetJsonLists()
        {
            restService = new RestService();
            RootObjectKat rootKat = new RootObjectKat();
            RootObjectHer rootHer = new RootObjectHer();

            try
            {
                rootKat = await restService.RefreshKategorieAsync();

                kategories             = rootKat.kategorie;
                katBezList             = rootKat.kategorie.Select(k => k.kat_bezeichnung).ToList();
                picker_kat.ItemsSource = katBezList;

                rootHer = await restService.RefreshHerstellerAsync();

                herstellers            = rootHer.hersteller;
                herBezList             = rootHer.hersteller.Select(h => h.her_bezeichnung).ToList();
                picker_her.ItemsSource = herBezList;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"				ERROR {0}", ex.Message);
            }
        }
        public async void GetData()
        {
            restService = new RestService();
            RootObjectKat objectKat = new RootObjectKat();

            kategorieList.RowHeight = 60;
            objectKat = await restService.RefreshKategorieAsync();

            kategorieList.ItemsSource = objectKat.kategorie;
        }
Beispiel #3
0
        public async Task <RootObjectKat> RefreshKategorieAsync()
        {
            Kategories = new RootObjectKat();

            var uri = new Uri(string.Format(Constants.KategorieRead, string.Empty));

            try
            {
                var response = await client.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    Kategories = JsonConvert.DeserializeObject <RootObjectKat>(content);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"				ERROR {0}", ex.Message);
            }
            return(Kategories);
        }