Пример #1
0
        public async void GetJson()
        {
            restService = new RestService();
            RootObject    rootObject    = new RootObject();
            RootObjectReg rootObjectReg = new RootObjectReg();

            try
            {
                rootObject = await restService.RefreshDataAsync();

                produkts               = rootObject.produkt;
                proBezList             = produkts.Select(p => p.pro_bezeichnung).ToList();
                picker_pro.ItemsSource = proBezList;

                rootObjectReg = await restService.RefreshRegalAsync();

                regals                 = rootObjectReg.regal;
                regBezList             = regals.Select(r => r.reg_bezeichnung).ToList();
                picker_reg.ItemsSource = regBezList;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"				ERROR {0}", ex.Message);
            }
        }
Пример #2
0
        public async Task <RootObjectReg> RefreshRegalAsync()
        {
            Regals = new RootObjectReg();

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

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

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

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