コード例 #1
0
        /// <summary>
        /// 根据现有的预定义菜单内容添加入口点。
        /// </summary>
        private void FetchOptions()
        {
            PrimaryItems.Clear();
            SecondaryItems.Clear();

            SecondaryItems.Add(new MasterPageItem("设置", "SettingPage"));

#if __IOS__
            AppleItems.Clear();
            InAppEntrance.Clear();

            var settingList = new InfoEntranceGroup("设置")
            {
                new TapEntranceWrapper("设置", "调整程序运行的参数。",
                                       (nav) => nav.PushAsync(SecondaryItems[0].CorePage)),
                new TapEntranceWrapper("关于", "程序的版本信息、开发人员、许可证和隐私声明等。",
                                       (nav) => nav.PushAsync(new AboutPage())),
            };
#endif

            AddMenuEntry("首页", "IndexPage", "\xE10F", sel: true, apple: "tab_rec.png");
            AddMenuEntry("课程表", "SchedulePage", "\xECA5", apple: "tab_sched.png");

#if !__ANDROID__
            if (Core.App.Feed != null)
            {
                AddMenuEntry("学校通知", "FeedPage", "\xED0D", apple: "tab_feed.png");
            }
            if (Core.App.Message != null)
            {
                AddMenuEntry("站内消息", "MessagePage", "\xE715");
            }
#else
            if (Core.App.Feed != null && Core.App.Message != null)
            {
                AddMenuEntry("消息通知", "MessageTabbedPage", "\xE715");
            }
            else if (Core.App.Feed != null)
            {
                AddMenuEntry("学校通知", "FeedPage", "\xED0D");
            }
            else if (Core.App.Message != null)
            {
                AddMenuEntry("站内消息", "MessagePage", "\xE715");
            }
#endif

            if (Core.App.GradePoint != null)
            {
                AddMenuEntry("学分成绩", "GradePointPage", "\xE82D");
            }
            if (Core.App.InfoEntrances.Count > 0 || Core.RuntimePlatform == "iOS")
            {
                AddMenuEntry("信息查询", "InfoQueryPage", "\xE946", apple: "tab_about.png");
            }

#if __IOS__
            if (InAppEntrance.Count > 0)
            {
                Core.App.InfoEntrances.Insert(0, InAppEntrance);
            }
            Core.App.InfoEntrances.Add(settingList);
#endif
        }