Esempio n. 1
0
        void Init()
        {
            MenuList = new List <MasterMenuItems>();  //Making a list here for the side menu navigation

            var orderPage = new MasterMenuItems()
            {
                Title = "Ваши заказы", IconSource = "ordersIcon.png", TargetType = typeof(OrderPage)
            };
            var settingPage = new MasterMenuItems()
            {
                Title = "Настройки", IconSource = "settingsIcon.png", TargetType = typeof(SettingsPage)
            };

            MenuList.Add(orderPage);
            MenuList.Add(settingPage);
            if (Convert.ToBoolean(App.UserDatabase.GetUser(Globals.Id).IntIsDev))
            {
                var adminPanel = new MasterMenuItems()
                {
                    Title = "Админ-панель", IconSource = "adminIcon.png", TargetType = typeof(AdminPage)
                };
                MenuList.Add(adminPanel);
            }


            mainMenuList.ItemsSource = MenuList;

            Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(OrderPage)));
        }
        void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            MasterMenuItems item = e.SelectedItem as MasterMenuItems;

            if (item != null)
            {
                Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
                masterpage.ListView.SelectedItem = null;
                IsPresented = false;
            }
        }
Esempio n. 3
0
 private void listaMenu_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     pagina = e.SelectedItem as MasterMenuItems;
     if (pagina.Title == "Monitorear")
     {
         Detail      = new MainPage(SolicitudMenu);
         IsPresented = false;
     }
     else if (pagina.TargetType.Equals(typeof(GeneralLoginPage)))
     {
         Application.Current.MainPage = new NavigationPage(new GeneralLoginPage());
     }
     else
     {
         Detail      = new NavigationPage((Page)Activator.CreateInstance(pagina.TargetType));
         IsPresented = false;
     }
 }
 /// <summary>
 /// Changes the view to the desired view from the listview of menuitems
 /// </summary>
 /// <param name="mmi"></param>
 private async void ChangeView(MasterMenuItems mmi)
 {
     IsPresented = false;
     ((MasterDetail)(MasterDetailPage)Application.Current.MainPage).ClearSelection();
     await NavigationService.NavigateToAsync(mmi.TargetViewModel);
 }
Esempio n. 5
0
        public MasterMenuPage(string _usuario)
        {
            InitializeComponent();

            if (_usuario != PerfilPage.refreshUsuario)
            {
                usuario = _usuario;
            }
            else
            {
                usuario = usuarioRefresh;
            }
            var hora    = DateTime.Now.Hour;
            var horario = DateTime.Now.ToShortTimeString();

            if (hora <= 12 && horario.Contains("a. m."))
            {
                btnPerfilUsuario.Text = $"Buenos días, {usuario}";
            }
            else if (hora >= 12 && hora <= 18 && horario.Contains("p. m."))
            {
                btnPerfilUsuario.Text = $"Buenas tardes, {usuario}";
            }
            else if (hora > 18 && hora <= 23 && horario.Contains("p. m."))
            {
                btnPerfilUsuario.Text = $"Buenas noches, {usuario}";
            }

            Detail        = new MainPage(SolicitudMenu);
            elementosMenu = new List <MasterMenuItems>();

            MasterMenuItems pagInicio = new MasterMenuItems()
            {
                Icon       = "iconoOjo.png",
                TargetType = typeof(MainPage),
                Title      = "Monitorear"
            };

            elementosMenu.Add(pagInicio);

            MasterMenuItems pagDormitorio = new MasterMenuItems()
            {
                Icon       = "iconoDormitorio.png",
                TargetType = typeof(ControlDormitorioPage),
                Title      = "Dormitorio"
            };

            elementosMenu.Add(pagDormitorio);

            MasterMenuItems pagCocina = new MasterMenuItems()
            {
                Icon       = "iconoCocina.png",
                TargetType = typeof(ControlCocinaPage),
                Title      = "Cocina"
            };

            elementosMenu.Add(pagCocina);

            MasterMenuItems pagBath = new MasterMenuItems()
            {
                Icon       = "iconoBano.png",
                TargetType = typeof(ControlBathPage),
                Title      = "Baño"
            };

            elementosMenu.Add(pagBath);

            MasterMenuItems pagLavado = new MasterMenuItems()
            {
                Icon       = "iconoLavado.png",
                TargetType = typeof(ControlLavadoPage),
                Title      = "Área de Lavado"
            };

            elementosMenu.Add(pagLavado);

            MasterMenuItems pagSala = new MasterMenuItems()
            {
                Icon       = "iconoSala.png",
                TargetType = typeof(ControlSalaPage),
                Title      = "Sala"
            };

            elementosMenu.Add(pagSala);

            MasterMenuItems pagRecibidor = new MasterMenuItems()
            {
                Icon       = "iconoRecibidor.png",
                TargetType = typeof(ControlRecibidorPage),
                Title      = "Recibidor"
            };

            elementosMenu.Add(pagRecibidor);

            MasterMenuItems pagPiscina = new MasterMenuItems()
            {
                Icon       = "iconoPiscina.png",
                TargetType = typeof(ControlPiscinaPage),
                Title      = "Piscina"
            };

            elementosMenu.Add(pagPiscina);

            MasterMenuItems pagTinaco = new MasterMenuItems()
            {
                Icon       = "iconoTinaco.png",
                TargetType = typeof(ControlTinacoPage),
                Title      = "Tinaco"
            };

            elementosMenu.Add(pagTinaco);

            MasterMenuItems pagExteriores = new MasterMenuItems()
            {
                Icon       = "iconoExterior.png",
                TargetType = typeof(ControlExterioresPage),
                Title      = "Exteriores"
            };

            elementosMenu.Add(pagExteriores);

            MasterMenuItems pagOpciones = new MasterMenuItems()
            {
                Icon       = "iconoOpciones.png",
                TargetType = typeof(OpcionesAdminPage),
                Title      = "Más opciones"
            };

            elementosMenu.Add(pagOpciones);

            MasterMenuItems pagSalir = new MasterMenuItems()
            {
                Icon       = "salir.png",
                TargetType = typeof(GeneralLoginPage),
                Title      = "Cerrar sesión"
            };

            elementosMenu.Add(pagSalir);

            listaMenu.ItemsSource   = elementosMenu;
            listaMenu.ItemSelected += listaMenu_ItemSelected;
        }