Ejemplo n.º 1
0
        /// <summary>
        /// Gets a reference to the main navigation. The property uses lazy loading, meaning that it's value isn't
        /// populated by the constructor, buit instead the first time the property is requested.
        /// </summary>
        /// <returns>An instance of <see cref="IEnumerable{NavItem}"/>.</returns>
        protected virtual IEnumerable <NavItem> GetMainNavigation()
        {
            // Just return the value if already loaded
            if (_mainNavigation != null)
            {
                return(_mainNavigation);
            }

            // Get the main nav items from the "culture" node
            IEnumerable <IPublishedContent> items = Culture.GetPropertyValue <IEnumerable <IPublishedContent> >(SkyConstants.Properties.MainNavigation);

            // Map the nav items and set the private field
            _mainNavigation = _mainNavigation = NavItem.GetItems(items);

            // Return the value
            return(_mainNavigation);
        }