示例#1
0
        public MenuListGroupedData()
        {
            NavigationGroup mainGroup = new NavigationGroup("Main Menu");

            NavMenuItem NavConfig = new NavMenuItem()
            {
                Title      = "Welcome",
                Icon       = "info.png",
                TargetType = typeof(pages.WelcomePage)
            };

            NavMenuItem NavAuthorize = new NavMenuItem()
            {
                Title      = "Settings",
                Icon       = "info.png",
                TargetType = typeof(pages.ConfigPage)
            };

            /*NavMenuItem NavCoursePage = new NavMenuItem () {
             *      Title = "Course Page",
             *      Icon = "l2plogo.png",
             *      CID = "14ws-44149",
             *      TargetType = typeof(pages.CourseRoomPage)
             * };*/

            mainGroup.Add(NavConfig);
            mainGroup.Add(NavAuthorize);
            //courseGroup.Add (NavCoursePage);
            // Debugging...
            //mainGroup.Add(NavCoursePage);

            this.Add(mainGroup);
            //this.Add (courseGroup);
        }
示例#2
0
文件: RootPage.cs 项目: auxua/Qurvey
        /// <summary>
        /// Depending on the selected item, go to the corresponding page
        /// </summary>
        /// <param name="menu">the menuitem, that was selected</param>
        void NavigateTo(NavMenuItem menu)
        {
            try {
                // If there is a Navigation inside the Page, Pop back to allow a working Navigation Stack
                if (Detail.Navigation != null)
                    Detail.Navigation.PopToRootAsync ();

                //if (Detail is pages.CourseRoomPage)
                if (Detail is NavigationPage) {
                    var page = ((NavigationPage)Detail).CurrentPage;
                    if (page is pages.CourseRoomPage) {
                        var bc = page.BindingContext as ViewModels.CourseRoomPageViewModel;
                        // Stop worker Threads if existing (Destructors are not called in guarantee...)
                        bc.CancelWork ();
                    }
                }
                // CourseRoomPages
                if (menu.TargetType == typeof(pages.CourseRoomPage)) {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.CourseRoomPage(menu.CID, menu.Title)) { BarBackgroundColor = Color.FromHex("FF4F45") };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.CourseRoomPage(menu.CID, menu.Title));
                    }
                    IsPresented = false;
                    return;
                }

                //Special Pages - manually for BarColors
                if (menu.TargetType == typeof(pages.ConfigPage))
                {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.ConfigPage()) { BarBackgroundColor = Color.FromHex("FF4F45") };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.ConfigPage());
                    }
                    IsPresented = false;
                    return;
                }

                if (menu.TargetType == typeof(pages.WelcomePage))
                {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.WelcomePage()) { BarBackgroundColor = Color.FromHex("FF4F45") };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.WelcomePage());
                    }
                    IsPresented = false;
                    return;
                }

                // Should never come here!
                Page displayPage = (Page)Activator.CreateInstance (menu.TargetType);
                Detail = new NavigationPage (displayPage);

                IsPresented = false;
            } catch (Exception e) {
                Device.BeginInvokeOnMainThread (() => {
                    DisplayAlert ("Error", "Could not load Page: " + e.Message, "Damn!");
                });
            }
        }
示例#3
0
 public void SetItemSource(ObservableCollection<NavigationGroup> source)
 {
     this.ItemsSource = source;
     source [0] [0].SetColors (false);
     selected = source [0] [0];
 }
示例#4
0
 public void SetItemSource(ObservableCollection <NavigationGroup> source)
 {
     this.ItemsSource = source;
     source [0] [0].SetColors(false);
     selected = source [0] [0];
 }
示例#5
0
文件: RootPage.cs 项目: auxua/Qurvey
        /// <summary>
        /// Depending on the selected item, go to the corresponding page
        /// </summary>
        /// <param name="menu">the menuitem, that was selected</param>
        void NavigateTo(NavMenuItem menu)
        {
            try {
                // If there is a Navigation inside the Page, Pop back to allow a working Navigation Stack
                if (Detail.Navigation != null)
                {
                    Detail.Navigation.PopToRootAsync();
                }

                //if (Detail is pages.CourseRoomPage)
                if (Detail is NavigationPage)
                {
                    var page = ((NavigationPage)Detail).CurrentPage;
                    if (page is pages.CourseRoomPage)
                    {
                        var bc = page.BindingContext as ViewModels.CourseRoomPageViewModel;
                        // Stop worker Threads if existing (Destructors are not called in guarantee...)
                        bc.CancelWork();
                    }
                }
                // CourseRoomPages
                if (menu.TargetType == typeof(pages.CourseRoomPage))
                {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.CourseRoomPage(menu.CID, menu.Title))
                        {
                            BarBackgroundColor = Color.FromHex("FF4F45")
                        };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.CourseRoomPage(menu.CID, menu.Title));
                    }
                    IsPresented = false;
                    return;
                }

                //Special Pages - manually for BarColors
                if (menu.TargetType == typeof(pages.ConfigPage))
                {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.ConfigPage())
                        {
                            BarBackgroundColor = Color.FromHex("FF4F45")
                        };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.ConfigPage());
                    }
                    IsPresented = false;
                    return;
                }

                if (menu.TargetType == typeof(pages.WelcomePage))
                {
                    if (Device.OS == TargetPlatform.Android)
                    {
                        Detail = new NavigationPage(new pages.WelcomePage())
                        {
                            BarBackgroundColor = Color.FromHex("FF4F45")
                        };
                    }
                    else
                    {
                        Detail = new NavigationPage(new pages.WelcomePage());
                    }
                    IsPresented = false;
                    return;
                }

                // Should never come here!
                Page displayPage = (Page)Activator.CreateInstance(menu.TargetType);
                Detail = new NavigationPage(displayPage);

                IsPresented = false;
            } catch (Exception e) {
                Device.BeginInvokeOnMainThread(() => {
                    DisplayAlert("Error", "Could not load Page: " + e.Message, "Damn!");
                });
            }
        }