Exemplo n.º 1
0
        private void ChangePage(object sender, SelectedItemChangedEventArgs e)
        {
            MenuItemPage seleccionado = (MenuItemPage)e.SelectedItem;

            Detail      = new NavigationPage((Page)Activator.CreateInstance(seleccionado.TypePage));
            IsPresented = false;
        }
Exemplo n.º 2
0
        private LoadMenu()
        {
            menuList = new List <MenuItemPage>();

            // Creating our pages for menu navigation
            // Here you can define title for item,
            // icon on the left side, and page that you want to open after selection
            var page1 = new MenuItemPage()
            {
                Title = "Page 1", Icon = "itemIcon1.png", TargetType = typeof(Page1)
            };
            var page2 = new MenuItemPage()
            {
                Title = "Page 2", Icon = "itemIcon2.png", TargetType = typeof(Page2)
            };
            var page3 = new MenuItemPage()
            {
                Title = "Page 3", Icon = "itemIcon3.png", TargetType = typeof(Page3)
            };

            // Adding menu items to menuList
            menuList.Add(page1);
            menuList.Add(page2);
            menuList.Add(page3);
        }
Exemplo n.º 3
0
 private NavigationItem CreateMenuItemPageItems(MenuItemPage menuItemPage)
 {
     return(new NavigationItem
     {
         Name = menuItemPage.Name,
         Link = menuItemPage.LinkURL
     });
 }
Exemplo n.º 4
0
        public PrincipalMaster()
        {
            InitializeComponent();

            MessagingCenter.Subscribe <PrincipalMaster>(this, "INIT", async(sender) => {
                PrincipalMaster view = new PrincipalMaster();
                await Application.Current.MainPage.Navigation.PushModalAsync(view);
            });

            this.MenuPages = new List <MenuItemPage>();

            User user = App.Locator.SessionService.Session.User;

            if (user != null)
            {
                Button btnlogout = new Button()
                {
                    Text = "Cerrar Sesión"
                };
                this.layoutLogout.Children.Add(btnlogout);
                btnlogout.SetBinding(Button.CommandProperty, "Logout");

                Label lab = new Label()
                {
                    Text            = App.Locator.SessionService.Session.User.Name,
                    FontSize        = 15,
                    TextColor       = Color.Blue,
                    VerticalOptions = LayoutOptions.Center,
                    FontAttributes  = FontAttributes.Bold
                };
                this.iniUsuario.Children.Add(lab);
            }
            else
            {
                var page1 = new MenuItemPage()
                {
                    Title    = "Iniciar sesión",
                    TypePage = typeof(Login)
                };
                this.MenuPages.Add(page1);
            }


            var page3 = new MenuItemPage()
            {
                Title    = "Inicio",
                TypePage = typeof(ListViewPage1)
            };

            this.MenuPages.Add(page3);
            this.lsvmenu.ItemsSource = this.MenuPages;
            Detail      = new NavigationPage((Page)Activator.CreateInstance(typeof(ListViewPage1)));
            IsPresented = false;
            this.lsvmenu.ItemSelected += ChangePage;
        }
Exemplo n.º 5
0
        public void ValidateNewItems()
        {
            HomePage     homepage = new HomePage(driver);
            MenuItemPage menupage = homepage.clickMenuLink();

            menupage.ClickSideTab();
            List <Item> items = menupage.getMenuItems(new MatchByRibbon("NEW"));

            Assert.AreEqual(items[0].getTitle(), "Korean Sticky Wings", "Name of the new item is not correct");
            Assert.AreEqual(items[0].getImageAltTag(), "Korean Sticky Wings", "Image alt tag of the new item is not correct");
        }
Exemplo n.º 6
0
        public void ValidItemByKilojoulesAndPrice()
        {
            HomePage     homepage = new HomePage(driver);
            MenuItemPage menupage = homepage.clickMenuLink();

            menupage.ClickSideTab();
            List <Item> items = menupage.getMenuItems(new MatchByTitle("Chunky Chips and Aioli"));

            Assert.AreEqual(items[0].getProductKilojoules(), "3273 kJ", "Kilojoules are incoorect");
            Assert.AreEqual(items[0].getProductPrice(), "$9.99", "Item price is incoorect");
        }
Exemplo n.º 7
0
        public void ValidVeganPizzaPrice()
        {
            HomePage     homepage = new HomePage(driver);
            MenuItemPage menupage = homepage.clickMenuLink();

            menupage.clickPizzaTab();
            List <Item> items = menupage.getMenuItems(new MatchByVegan());

            foreach (Item menuItem in items)
            {
                Assert.AreEqual(menuItem.getProductPrice(), "$14.99", "price of " + menuItem.GetItemName() + " is not correct");
            }
        }
Exemplo n.º 8
0
        public MainPage()
        {
            InitializeComponent();

            listaMenu = new List <MenuItemPage>();

            var page1 = new MenuItemPage()
            {
                Title = "Estaciones de recarga favoritas", TargetType = typeof(CreditsPage)
            };
            var page2 = new MenuItemPage()
            {
                Title = "Busquedas recientes", TargetType = typeof(SearchPage)
            };
            var page3 = new MenuItemPage()
            {
                Title = "Busqueda por ciudades", TargetType = typeof(SearchPage)
            };
            var page4 = new MenuItemPage()
            {
                Title = "Busqueda por provincias", TargetType = typeof(SearchPage)
            };
            var page5 = new MenuItemPage()
            {
                Title = "Creditos", TargetType = typeof(CreditsPage)
            };
            var page6 = new MenuItemPage()
            {
                Title = "Configuracion", TargetType = typeof(ConfigPage)
            };

            listaMenu.Add(page1);
            listaMenu.Add(page2);
            listaMenu.Add(page3);
            listaMenu.Add(page4);
            listaMenu.Add(page5);
            listaMenu.Add(page6);


            navigationList.ItemsSource = listaMenu;
            Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(SearchPage)));
        }
Exemplo n.º 9
0
        public void MenuItemStarRating()
        {
            HomePage     homepage = new HomePage(driver);
            MenuItemPage menupage = homepage.clickMenuLink();

            menupage.clickDrinkTab();
            List <Item> items = menupage.getMenuItems(new MatchByStar(0));

            items[0].ClickStar(3);
            Assert.AreEqual(items[0].getStarRating(), 0, "All star did not have 0 rating ");

            LoginDialog loginDialog = menupage.ClickLoginLink();

            loginDialog.SetUserName("bob");
            loginDialog.SetPassowrd("ilovepizza");
            loginDialog.ClickLogin();

            items[0].ClickStar(3);
            Assert.AreEqual(items[0].getStarRating(), 3, "Incorrect number of stars ");
        }
Exemplo n.º 10
0
        public void OrderSubtotalValidation()
        {
            HomePage     homePage = new HomePage(driver);
            MenuItemPage menuPage = homePage.clickMenuLink();

            menuPage.clickDrinkTab();
            List <Item> menuItems = menuPage.getMenuItems(new MatchByTitle("Espresso Thickshake"));

            menuItems[0].ClickOrderButton();

            menuPage.clickPizzaTab();
            menuItems = menuPage.getMenuItems(new MatchByTitle("Margherita"));
            menuItems[0].ClickOrderButton();
            menuItems[0].ClickOrderButton();

            Assert.AreEqual("3", menuPage.GetOrderCount(), "The order count is not correct");
            OrderPage orderPage = menuPage.ClickOrderLink();

            Assert.AreEqual("4.99", orderPage.GetItemSubtotal("Espresso Thickshake"), "subtotal was incorrect");
        }
Exemplo n.º 11
0
        public PrincipalMaster()
        {
            InitializeComponent();

            MessagingCenter.Subscribe <PrincipalMaster>(this, "INICIAR", async(sender) => {
                PrincipalMaster view = new PrincipalMaster();
                await Application.Current.MainPage.Navigation.PushModalAsync(view);
            });

            this.MenuPaginas = new List <MenuItemPage>();
            Usuario usuario = App.Locator.SessionService.Sesion.usuario;

            if (usuario == null)
            {
                var page1 = new MenuItemPage()
                {
                    Titulo     = "Login",
                    TipoPagina = typeof(Login)
                };
                this.MenuPaginas.Add(page1);
                var page2 = new MenuItemPage()
                {
                    Titulo     = "Registro",
                    TipoPagina = typeof(Registro)
                };
                this.MenuPaginas.Add(page2);
            }
            else
            {
                var page1 = new MenuItemPage()
                {
                    Titulo     = "Mi perfil",
                    TipoPagina = typeof(MiPerfil)
                };
                this.MenuPaginas.Add(page1);
                var page2 = new MenuItemPage()
                {
                    Titulo     = "Mis reservas",
                    TipoPagina = typeof(MisReservas)
                };
                this.MenuPaginas.Add(page2);

                Button boton = new Button()
                {
                    Text = "Cerrar Sesión"
                };
                boton.SetBinding(Button.CommandProperty, "CerrarSesion");
                this.layout.Children.Add(boton);
                //this.layout = new StackLayout {
                //    Children = {
                //        boton
                //    }
                //};
            }

            var page3 = new MenuItemPage()
            {
                Titulo     = "Inicio",
                TipoPagina = typeof(Inicio)
            };

            this.MenuPaginas.Add(page3);
            this.lsvmenu.ItemsSource = this.MenuPaginas;
            Detail      = new NavigationPage((Page)Activator.CreateInstance(typeof(Inicio)));
            IsPresented = false;
            this.lsvmenu.ItemSelected += CambiarPagina;
        }