/// <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 }
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; }
private void WriteAfter(HtmlTextWriter xml, MenuPart menuPart) { xml.RenderEndTag(); // </div> }
/// <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 }
public MenuPartRenderer(MenuPart menuPart) { this.menuPart = menuPart; database = BuildNavTree(); }