Exemplo n.º 1
0
        /// <summary>
        /// Called when page is retrieved.
        /// </summary>
        /// <param name="renderPageData">The rendering page data.</param>
        /// <param name="pageData">The page data.</param>
        public PageRetrievedEventResult OnPageRetrieved(RenderPageViewModel renderPageData, IPage pageData)
        {
            if (PageRetrieved != null)
            {
                var args = new PageRetrievedEventArgs(renderPageData, pageData);
                PageRetrieved(args);
                return(args.EventResult);
            }

            return(PageRetrievedEventResult.None);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Occurs, when the page is retrieved.
 /// </summary>
 /// <param name="args">The <see cref="PageRetrievedEventArgs" /> instance containing the event data.</param>
 private void Events_PageRetrieved(PageRetrievedEventArgs args)
 {
     if (args != null && args.RenderPageData != null)
     {
         args.RenderPageData.ExtendWithPageData(args.PageData);
     }
 }
        /// <summary>
        /// Occurs, when the page is retrieved.
        /// </summary>
        /// <param name="args">The <see cref="PageRetrievedEventArgs" /> instance containing the event data.</param>
        private void Events_PageRetrieved(PageRetrievedEventArgs args)
        {
            if (args == null || args.RenderPageData == null)
            {
                return;
            }

            ExtendPageWithPageData(args.RenderPageData, args.PageData);

            if (!args.RenderPageData.IsBlogPost())
            {
                return; // Default handling.
            }

            if (args.RenderPageData.CanManageContent)
            {
                return; // Default handling.
            }

            if (args.RenderPageData.Status != PageStatus.Published)
            {
                return; // Default handling.
            }

            if (args.RenderPageData.Contents.Any(projection => projection.PageContentStatus != ContentStatus.Published))
            {
                return; // Default handling.
            }

            if (!args.RenderPageData.IsBlogPostActive())
            {
                args.EventResult = PageRetrievedEventResult.ForcePageNotFound;
            }
        }