Exemple #1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            var template = new DataTemplate(typeof(DefaultTemplate));
            var view     = new AccordionView(template);

            List <Section>      ListaCategoria = new List <Section>();
            List <ShoppingCart> ListaProductos = null;

            view.SetBinding(AccordionView.ItemsSourceProperty, "List");
            view.Template.SetBinding(AccordionSectionView.TitleProperty, "Title");
            view.Template.SetBinding(AccordionSectionView.ItemsSourceProperty, "List");
            Xamarin.Forms.Device.BeginInvokeOnMainThread(async() =>
            {
                BD.ObtenerResul obtenerResul = new BD.ObtenerResul();
                var img  = await obtenerResul.GetList <BD.ClasesBd>("http://tools.agorafranquicias.com/APP/Consultas/nombreImagenCategoriaLocal.php");
                var prod = await obtenerResul.GetList <ClasesBd>("http://tools.agorafranquicias.com/APP/Consultas/ShoppingCart.php");
                if (img != null)
                {
                    foreach (BD.NombreImagenCategoria Cat in img.Nombreimagencategoria)
                    {
                        ListaProductos = new List <ShoppingCart>();
                        foreach (ShoppingCart productos in prod.ShoppingCart)
                        {
                            if (Cat.Id == productos.Id_Categoria)
                            {
                                ListaProductos.Add(productos);
                            }
                        }
                        ListaCategoria.Add(new Section
                        {
                            Title = Cat.URL,
                            List  = ListaProductos
                        });
                    }
                    view.BindingContext = new ViewModel
                    {
                        List = ListaCategoria
                    };
                    this.Content = view;
                }
                else
                {
                    await Navigation.PushPopupAsync(new DialogoError());
                }
            });
        }
Exemple #2
0
        //Método que muestra toda la carta que hay para domicilio
        private void domicilio()
        {
            var                 template       = new DataTemplate(typeof(DefaultTemplate));
            var                 view           = new AccordionView(template);
            List <Section>      ListaCategoria = new List <Section>();
            List <ShoppingCart> ListaProductos = null;

            view.SetBinding(AccordionView.ItemsSourceProperty, "List");
            view.Template.SetBinding(AccordionSectionView.TitleProperty, "Title");
            view.Template.SetBinding(AccordionSectionView.ItemsSourceProperty, "List");
            Xamarin.Forms.Device.BeginInvokeOnMainThread(async() =>
            {
                ObtenerResul obtenerResul = new ObtenerResul();
                var img  = await obtenerResul.GetList <ClasesBd>("http://tools.agorafranquicias.com/APP/Consultas/nombreImagenCategoriaDomicilio.php");
                var prod = await obtenerResul.GetList <ClasesBd>("http://tools.agorafranquicias.com/APP/Consultas/ShoppingCart.php");
                if (img != null)
                {
                    foreach (BD.NombreImagenCategoria Cat in img.Nombreimagencategoria)
                    {
                        ListaProductos = new List <ShoppingCart>();
                        foreach (ShoppingCart productos in prod.ShoppingCart)
                        {
                            if (Cat.Id == productos.Id_Categoria)
                            {
                                ListaProductos.Add(productos);
                            }
                        }
                        ListaCategoria.Add(new Section
                        {
                            Title = Cat.URL,
                            List  = ListaProductos
                        });
                    }
                    view.BindingContext = new ViewModel
                    {
                        List = ListaCategoria
                    };
                    this.Content = view;
                }
                else
                {
                    await Navigation.PushPopupAsync(new DialogoError());
                }

                Image Llamar = new Image()
                {
                    Source       = "http://tools.agorafranquicias.com/APP/Images/Otros/Llamar.jpg",
                    WidthRequest = 500,
                };


                var TapedLlamar     = new TapGestureRecognizer();
                TapedLlamar.Tapped += TapImgLlamar;
                Llamar.GestureRecognizers.Add(TapedLlamar);

                AbsoluteLayout AbsoluteLayout = new AbsoluteLayout();

                AbsoluteLayout.SetLayoutBounds(Llamar, new Rectangle(55, 330, 250, 300));
                AbsoluteLayout.SetLayoutBounds(view, new Rectangle(0, 0, 380, 430));

                AbsoluteLayout.Children.Add(view);
                AbsoluteLayout.Children.Add(Llamar);


                this.Content = AbsoluteLayout;
            });
        }