Exemple #1
0
        public void AdminMenu(int?level, BackendPage parent, AdminMenuTemplate template)
        {
            BackendPage selectedPage = null;

            BackendPage[] subPages = null;

            if (CurrentPage == null)
            {
                subPages = BackendPages;
                goto label_currentPageNull;
            }



            if (level == 1)
            {
                if (CurrentPage.ParentPage == null)
                {
                    selectedPage = CurrentPage;
                }
                else if (CurrentPage.ParentPage.ParentPage == null)
                {
                    selectedPage = CurrentPage.ParentPage;
                }
                else
                {
                    selectedPage = CurrentPage.ParentPage.ParentPage;
                }

                subPages = BackendPages;
            }
            else if (level == 2)
            {
                if (CurrentPage.ParentPage == null) //如果当前页是第一级,那么就不可能存在第二级页面,也不可能有第二级的选中页面
                {
                    selectedPage = null;
                }
                else if (CurrentPage.ParentPage.ParentPage == null) //如果当前页是第二级,那么选中页就正好是当前页
                {
                    selectedPage = CurrentPage;
                }
                else
                {
                    selectedPage = CurrentPage.ParentPage; //如果当前页面是第三级页面,那么选中的页面就是当前页面的父级页面
                }
            }
            else
            {
                if (CurrentPage.ParentPage == null || CurrentPage.ParentPage.ParentPage == null) //如果当前页是第一或二级,那么就不可能存在第三级页面
                {
                    selectedPage = null;
                }
                else
                {
                    selectedPage = CurrentPage;
                }
            }

            if (parent != null)
            {
                subPages = parent.SubPages;
            }
            else if (selectedPage != null && subPages == null)
            {
                subPages = selectedPage.ParentPage.SubPages;
            }

label_currentPageNull:

            if (subPages != null)
            {
                int i = 1;

                foreach (BackendPage subPage in subPages)
                {
                    template(i, subPage, selectedPage);
                    i++;
                }
            }
        }
        public void AdminMenu(int? level, BackendPage parent, AdminMenuTemplate template)
        {

            BackendPage selectedPage = null;
            BackendPage[] subPages = null;

            if (CurrentPage == null)
            {
                subPages = BackendPages;
                goto label_currentPageNull;
            }



            if (level == 1)
            {
                if (CurrentPage.ParentPage == null)
                    selectedPage = CurrentPage;
                else if (CurrentPage.ParentPage.ParentPage == null)
                    selectedPage = CurrentPage.ParentPage;
                else
                    selectedPage = CurrentPage.ParentPage.ParentPage;

                subPages = BackendPages;
            }
            else if (level == 2)
            {
                if (CurrentPage.ParentPage == null) //如果当前页是第一级,那么就不可能存在第二级页面,也不可能有第二级的选中页面
                    selectedPage = null;
                else if (CurrentPage.ParentPage.ParentPage == null) //如果当前页是第二级,那么选中页就正好是当前页
                    selectedPage = CurrentPage;
                else
                    selectedPage = CurrentPage.ParentPage; //如果当前页面是第三级页面,那么选中的页面就是当前页面的父级页面
            }
            else
            {
                if (CurrentPage.ParentPage == null || CurrentPage.ParentPage.ParentPage == null) //如果当前页是第一或二级,那么就不可能存在第三级页面
                    selectedPage = null;
                else
                    selectedPage = CurrentPage;
            }

            if (parent != null)
                subPages = parent.SubPages;
            else if (selectedPage != null && subPages == null)
                subPages = selectedPage.ParentPage.SubPages;

label_currentPageNull:

            if (subPages != null)
            {
                int i = 1;

                foreach (BackendPage subPage in subPages)
                {
                    template(i, subPage, selectedPage);
                    i++;
                }
            }
        }
Exemple #3
0
 public void AdminMenu(int?level, AdminMenuTemplate template)
 {
     AdminMenu(level, null, template);
 }
		public void AdminMenu(int? level, AdminMenuTemplate template)
		{
			AdminMenu(level, null, template);
		}