Пример #1
0
        private async void Menu3_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Uri ruta = new Uri("http://doniaelena.anabiosis.com.mx/menu.json", UriKind.Absolute);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ruta);
                WebResponse response = await request.GetResponseAsync();
                Stream stream = response.GetResponseStream();
                string contenido = Comun.LecturaDatos(stream);
                var obj = JsonConvert.DeserializeObject<RootObject>(contenido);

                List<ParaDesayunar> lstParaDesayunar = new List<ParaDesayunar>();
                for (int i = 0; i < obj.ParaDesayunar.Count; i++)
                {
                    ParaDesayunar pd = new ParaDesayunar();
                    pd.title = obj.ParaDesayunar[i].title.ToString();
                    pd.description = obj.ParaDesayunar[i].description.ToString();
                    lstParaDesayunar.Add(pd);
                }

                GridView gvParaDesayunar = Comun.FindChildControl<GridView>(HubPrincipal, "gvParaDesayunar") as GridView;
                gvParaDesayunar.ItemsSource = lstParaDesayunar.ToList();


                List<AntojosDulces> lstAntojosDulces = new List<AntojosDulces>();
                for (int i = 0; i < obj.AntojosDulces.Count; i++)
                {
                    AntojosDulces ad = new AntojosDulces();
                    ad.title = obj.AntojosDulces[i].title.ToString();
                    ad.description = obj.AntojosDulces[i].description.ToString();
                    lstAntojosDulces.Add(ad);
                }

                GridView gvAntojosDulces = Comun.FindChildControl<GridView>(HubPrincipal, "gvAntojosDulces") as GridView;
                gvAntojosDulces.ItemsSource = lstAntojosDulces.ToList();

            }
            catch (Exception error)
            {
                Windows.UI.Popups.MessageDialog msg = new Windows.UI.Popups.MessageDialog(error.ToString());
                var resp = msg.ShowAsync();
            }
        }
Пример #2
0
        private async void Menu3_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Uri            ruta     = new Uri("http://doniaelena.anabiosis.com.mx/menu.json", UriKind.Absolute);
                HttpWebRequest request  = (HttpWebRequest)WebRequest.Create(ruta);
                WebResponse    response = await request.GetResponseAsync();

                Stream stream    = response.GetResponseStream();
                string contenido = Comun.LecturaDatos(stream);
                var    obj       = JsonConvert.DeserializeObject <RootObject>(contenido);

                List <ParaDesayunar> lstParaDesayunar = new List <ParaDesayunar>();
                for (int i = 0; i < obj.ParaDesayunar.Count; i++)
                {
                    ParaDesayunar pd = new ParaDesayunar();
                    pd.title       = obj.ParaDesayunar[i].title.ToString();
                    pd.description = obj.ParaDesayunar[i].description.ToString();
                    lstParaDesayunar.Add(pd);
                }

                GridView gvParaDesayunar = Comun.FindChildControl <GridView>(HubPrincipal, "gvParaDesayunar") as GridView;
                gvParaDesayunar.ItemsSource = lstParaDesayunar.ToList();


                List <AntojosDulces> lstAntojosDulces = new List <AntojosDulces>();
                for (int i = 0; i < obj.AntojosDulces.Count; i++)
                {
                    AntojosDulces ad = new AntojosDulces();
                    ad.title       = obj.AntojosDulces[i].title.ToString();
                    ad.description = obj.AntojosDulces[i].description.ToString();
                    lstAntojosDulces.Add(ad);
                }

                GridView gvAntojosDulces = Comun.FindChildControl <GridView>(HubPrincipal, "gvAntojosDulces") as GridView;
                gvAntojosDulces.ItemsSource = lstAntojosDulces.ToList();
            }
            catch (Exception error)
            {
                Windows.UI.Popups.MessageDialog msg = new Windows.UI.Popups.MessageDialog(error.ToString());
                var resp = msg.ShowAsync();
            }
        }