コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuPartRenderer"/> class.
        /// </summary>
        /// <param name="menuPart">The menu part to be rendered.</param>
        public MenuPartRenderer(MenuPart menuPart)
        {
            this.menuPart = menuPart;
            var page = Context.CurrentPage;

            // Need the current page ID regardless of cached database or not to render selected page correctly.
            currentPageId = page == null ? 0 : page.ID;

#if NO_MENUPART_CACHE
            database = BuildNavigationTree(page);
#else
            if (page != null)
            {
                var cacheKey  = String.Concat(page.ID.ToString(CultureInfo.InvariantCulture), "+", menuPart.AncestralTrail);
                var cacheData = System.Web.Hosting.HostingEnvironment.Cache.Get(cacheKey);
                if (cacheData == null)
                {
                    cacheData = BuildNavigationTree(page);
                    System.Web.Hosting.HostingEnvironment.Cache.Add(cacheKey, cacheData, null, DateTime.Now.AddSeconds(15),
                                                                    System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
                }
                database = (List <ContentTreeNode>)cacheData;
            }
            else
            {
                database = new List <ContentTreeNode>();
            }
#endif
        }
コード例 #2
0
ファイル: MenuPart.cs プロジェクト: fniwes/n2cms
        public MenuPartRenderer(MenuPart menuPart)
        {
            this.menuPart = menuPart;
            var cacheKey  = String.Concat(N2.Context.CurrentPage.ID.ToString(), "+", menuPart.AncestralTrail);
            var cacheData = System.Web.Hosting.HostingEnvironment.Cache.Get(cacheKey);

            if (cacheData == null)
            {
                cacheData = BuildNavTree();
                System.Web.Hosting.HostingEnvironment.Cache.Add(cacheKey, cacheData, null, DateTime.Now.AddSeconds(15),
                                                                System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
            }
            database = (List <ContentTreeNode>)cacheData;
        }
コード例 #3
0
ファイル: ResponsiveMenuPart.cs プロジェクト: xychb/n2cms
 private void WriteAfter(HtmlTextWriter xml, MenuPart menuPart)
 {
     xml.RenderEndTag();             // </div>
 }
コード例 #4
0
ファイル: MenuPart.cs プロジェクト: EzyWebwerkstaden/n2cms
		/// <summary>
		/// Initializes a new instance of the <see cref="MenuPartRenderer"/> class.
		/// </summary>
		/// <param name="menuPart">The menu part to be rendered.</param>
		public MenuPartRenderer(MenuPart menuPart)
		{
			this.menuPart = menuPart;
			var page = Context.CurrentPage;

			// Need the current page ID regardless of cached database or not to render selected page correctly.
			currentPageId = page == null ? 0 : page.ID;

#if NO_MENUPART_CACHE
			database = BuildNavigationTree(page);
#else
		    if (page != null)
		    {
		        var cacheKey = String.Concat(page.ID.ToString(CultureInfo.InvariantCulture), "+", menuPart.AncestralTrail);
		        var cacheData = System.Web.Hosting.HostingEnvironment.Cache.Get(cacheKey);
		        if (cacheData == null)
		        {
		            cacheData = BuildNavigationTree(page);
		            System.Web.Hosting.HostingEnvironment.Cache.Add(cacheKey, cacheData, null, DateTime.Now.AddSeconds(15),
		                System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
		        }
		        database = (List<ContentTreeNode>) cacheData;
		    }
		    else
		    {
		        database = new List<ContentTreeNode>();
		    }
#endif
		}
コード例 #5
0
		private void WriteAfter(HtmlTextWriter xml, MenuPart menuPart)
		{
			xml.RenderEndTag(); // </div>
		}
コード例 #6
0
ファイル: MenuPart.cs プロジェクト: brianmatic/n2cms
		public MenuPartRenderer(MenuPart menuPart)
		{
			this.menuPart = menuPart;
			database = BuildNavTree();
		}