コード例 #1
0
        public LoadingPage()
        {
            InitializeComponent();

            DependencyService.Register <IMenuPage>();
            menuPage = DependencyService.Get <IMenuPage>();

            Thread thread = new Thread(Start);

            thread.Start();
        }
コード例 #2
0
 public MenuViewModel(IMenuPage view)
 {
     this.view = view;
     Menu      = new ObservableCollection <MenuModel> {
         new MenuModel {
             Title = "Запись", Icon = "icon.png", TargetType = typeof(AboutPage)
         },
         new MenuModel {
             Title = "Новости", Icon = "icon.png", TargetType = typeof(AboutPage)
         },
         new MenuModel {
             Title = "Акции", Icon = "icon.png", TargetType = typeof(AboutPage)
         },
         new MenuModel {
             Title = "О программе", Icon = "icon.png", TargetType = typeof(SecondPage)
         },
     };
 }
コード例 #3
0
 protected void SetSelectedMenu(List <MenuInfo> menuList, int level)
 {
     if (this.Page is IMenuPage)
     {
         IMenuPage page = this.Page as IMenuPage;
         foreach (MenuInfo menu in menuList)
         {
             bool selected = false;
             if (level == 1)
             {
                 selected = menu.Id.Equals(page.GetTopMenuId(), StringComparison.OrdinalIgnoreCase);
             }
             else if (level == 2)
             {
                 selected = menu.Id.Equals(page.GetSecondMenuId(), StringComparison.OrdinalIgnoreCase);
             }
             menu.CssName = selected ? "Selected" : "UnSelected";
         }
     }
 }
コード例 #4
0
        /// <summary>
        /// 设置显示的菜单项
        /// </summary>
        /// <param name="groups">菜单项分组列表</param>
        /// <param name="page">菜单页</param>
        public static void SetupFrom(this IList <MenuItemGroup> groups, IMenuPage page)
        {
            // 没有权限时不显示菜单项
            var sessionManager   = Application.Ioc.Resolve <SessionManager>();
            var privilegeManager = Application.Ioc.Resolve <PrivilegeManager>();
            var user             = sessionManager.GetSession().GetUser();

            if (user == null || !privilegeManager.HasUserType(user, page.RequiredUserType) ||
                !privilegeManager.HasPrivileges(user, page.RequiredPrivileges))
            {
                return;
            }
            // 添加菜单项
            var group = groups.FirstOrDefault(g => g.Name == page.Group);

            if (group == null)
            {
                group = new MenuItemGroup(page.Group, page.GroupIconClass);
                groups.Add(group);
            }
            group.Items.AddItemForLink(new T(page.Name), page.IconClass, page.Url);
        }
コード例 #5
0
    public void SwitchToPage(IMenuPage page)
    {
        if (page == null)
        {
            return;
        }

        if (!pages.Contains(page))
        {
            var parentPageGroup = transform.parent.GetComponentInParent <MenuPageGroup>();
            if (parentPageGroup != null)
            {
                parentPageGroup.SwitchToPage(page);
            }

            return;
        }

        ActivePage.gameObject.SetActive(false);
        ActivePage = page;
        ActivePage.gameObject.SetActive(true);
    }
コード例 #6
0
    private void Awake()
    {
        Debug.Assert(InitialPage != null, "InitialPage must be set.");

        foreach (Transform t in transform)
        {
            var page = t.gameObject.GetComponent <IMenuPage>();
            if (page != null)
            {
                pages.Add(page);
                page.gameObject.SetActive(false);
            }
        }

        if (!pages.Contains(InitialPage))
        {
            Debug.LogError("InitialPage is not a child of this " + gameObject.name + " page group.");
            return;
        }

        ActivePage = InitialPage;
        ActivePage.gameObject.SetActive(true);
    }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuSteps" /> class.
 /// </summary>
 /// <param name="setUp">The set up.</param>
 /// <param name="UnreleasedResultPage">The unreleased results page.</param>
 public MenuSteps(IMenuPage menuPage)
 {
     this.menuPage = menuPage;
 }
コード例 #8
0
 public void AddPage(string name, IMenuPage page)
 {
     Pages[name] = page;
     InitialPage = InitialPage ?? name;
 }
コード例 #9
0
 public void Replace(IMenuPage page)
 {
     Pop();
     Push(page);
 }
コード例 #10
0
 public void Push(IMenuPage page)
 {
     History.Push(page);
 }