Esempio n. 1
0
        public HomeView()
        {
            pages          = new Dictionary <MenuType, NavigationPage>();
            BindingContext = new HomeViewModel();

            Master = master = new HomeMasterView(ViewModel);

            var homeNav = new NavigationPage(master.PageSelection)
            {
                BarBackgroundColor = Color.FromHex("#3498DB"),
                BarTextColor       = Color.White
            };

            Detail = homeNav;

            pages.Add(MenuType.About, homeNav);

            master.PageSelectionChanged = async(menuType) =>
            {
                if (Detail != null && Device.OS == TargetPlatform.WinPhone)
                {
                    await Detail.Navigation.PopToRootAsync();
                }

                NavigationPage newPage;
                if (pages.ContainsKey(menuType))
                {
                    newPage = pages[menuType];
                }
                else
                {
                    newPage = new NavigationPage(master.PageSelection)
                    {
                        BarBackgroundColor = Color.FromHex("#3498DB"),
                        BarTextColor       = Color.White
                    };
                    pages.Add(menuType, newPage);
                }
                Detail       = newPage;
                Detail.Title = master.PageSelection.Title;
                if (Device.Idiom != TargetIdiom.Tablet)
                {
                    IsPresented = false;
                }
            };

            this.Icon = "slideout.png";
        }
Esempio n. 2
0
        public HomeView()
        {
            pages = new Dictionary<MenuType, NavigationPage>();
            BindingContext = new HomeViewModel();

            Master = master = new HomeMasterView(ViewModel);

            var homeNav = new NavigationPage(master.PageSelection)
            {
                BarBackgroundColor = Color.FromHex("#3498DB"),
                BarTextColor = Color.White
            };
            Detail = homeNav;

            pages.Add(MenuType.About, homeNav);

            master.PageSelectionChanged = async (menuType) =>
            {

                if (Detail != null && Device.OS == TargetPlatform.WinPhone)
                {
                    await Detail.Navigation.PopToRootAsync();
                }

                NavigationPage newPage;
                if (pages.ContainsKey(menuType))
                {
                    newPage = pages[menuType];
                }
                else
                {
                    newPage = new NavigationPage(master.PageSelection)
                    {
                        BarBackgroundColor = Color.FromHex("#3498DB"),
                        BarTextColor = Color.White
                    };
                    pages.Add(menuType, newPage);
                }
                Detail = newPage;
                Detail.Title = master.PageSelection.Title;
                if (Device.Idiom != TargetIdiom.Tablet)
                    IsPresented = false;
            };

            this.Icon = "slideout.png";
        }