Ejemplo n.º 1
0
        public DrawerListPage(RootPage rootPage)
        {
            _rootPage = rootPage;
            InitializeComponent();


            Title = " ";

            if (App.CurrentApp.User != null)
            {
                _labelNombre.Text += " " + App.CurrentApp.User.Nombre + " " + App.CurrentApp.User.Apellido_Paterno;
            }

            list = new ObservableCollection <ItemDrawer>();

            list.Add(new ItemDrawer()
            {
                Label = "Perfil",
                Page  = DrawerPage.Perfil,
                Image = "avatar.png",
            });

            list.Add(new ItemDrawer()
            {
                Label = "Historial",
                Page  = DrawerPage.Envios,
                Image = "history-clock-button.png",
            });

            list.Add(new ItemDrawer()
            {
                Label = "Pago",
                Page  = DrawerPage.MetodosPago,
                Image = "credit-card.png",
            });
            list.Add(new ItemDrawer()
            {
                Label = "Instrucciones",
                Page  = DrawerPage.MetodosPago,
                Image = "bullets.png",
            });
            list.Add(new ItemDrawer()
            {
                Label = "Privacidad",
                Page  = DrawerPage.MetodosPago,
                Image = "protection-shield.png",
            });
            list.Add(new ItemDrawer()
            {
                Label = "Referral",
                Page  = DrawerPage.MetodosPago,
                Image = "share.png",
            });
            list.Add(new ItemDrawer()
            {
                Label = "Cerrar Sesión",
                Page  = DrawerPage.MetodosPago,
                Image = "turnoff.png",
            });

            //list.Add(new ItemDrawer()
            //{
            //	Label = "Ajustes",
            //	Page = DrawerPage.Ajuste,
            //	Image="cogW.png",
            //});

            ListView.ItemsSource   = list;
            ListView.ItemSelected += (sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                var item = e.SelectedItem as ItemDrawer;
                if (PageSelected != null)
                {
                    PageSelected(item.Page);
                }

                foreach (var n in list)
                {
                    n.Selected = false;
                }
                item.Selected = true;

                //if (item.Page == DrawerPage.Obvservatorios || item.Page == DrawerPage.Categorias)
                //	item.Selected = false;

                ListView.ItemsSource  = new ObservableCollection <ItemDrawer>(list);
                ListView.SelectedItem = null;
            };

            ImageSourceChanged = async() =>
            {
                if (LastView is FFImageLoading.Forms.CachedImage)
                {
                    (LastView as FFImageLoading.Forms.CachedImage).Source = Source;
                }

                _imageView.Source = Source;

                //await PostLastFoto();
            };


            //ImagesUploaded += (folio) =>
            //{
            //	ActualizarFotoCliente(folio);
            //};

            //MessagingCenter.Subscribe<PerfilPage>(this, "update_info_user", (sender) =>
            //{
            //		// do something whenever the "Hi" message is sent
            //		if (App.CurrentApp.User != null)
            //		_labelNombre.Text = App.CurrentApp.User.Nombre;
            //	GetFoto();
            //});

            GetFoto();
        }