Exemplo n.º 1
0
 public PageParser(string rootDirectory, string rootUri)
 {
     _rootDirectory = rootDirectory;
     _rootUri = rootUri.Trim('/');
     _pageSource = new PageSource(rootUri, rootDirectory);
     PreFilters = new PreFilterCollection();
     PostFilters = new PostFilterCollection();
     MissingLinkStyle = "color: red";
     DefaultCodeLanguage = "text";
 }
Exemplo n.º 2
0
 private static PageReference GetWorkroomStartPageLink(IPageSource page)
 {
     if (page.CurrentPage.PageTypeName.Equals(WorkroomListPageTypeName, StringComparison.OrdinalIgnoreCase))
     {
         return(page.CurrentPage.PageLink);
     }
     else
     {
         return(page.CurrentPage[_workroomStartProperty] as PageReference);
     }
 }
Exemplo n.º 3
0
        public T CurrentPage <T>(IPageSource page) where T : PageData
        {
            var cPage = page.CurrentPage;

            if (cPage == null)
            {
                return(null);
            }
            var typedPage = cPage as T;

            if (typedPage != null)
            {
                return(typedPage);
            }
            if (cPage.PageLink == PageReference.StartPage)
            {
                return(IoC.Get <T>());
            }
            var msg = string.Format("Invalid PageType on page '{0}', a page of type '{1}' was expected, but got '{2}'.",
                                    cPage.PageLink, typeof(T).FullName, cPage.GetType().FullName);

            throw new InvalidOperationException(msg);
        }
Exemplo n.º 4
0
 public static T CurrentPage <T>(this IPageSource page) where T : PageData
 {
     return(IoC.Get <ICurrentPageResolver>().CurrentPage <T>(page));
 }
Exemplo n.º 5
0
 public void SendPage(string aStatus, IPageSource aPageSource)
 {
     Dictionary<string, IEnumerable<string>> headers = new Dictionary<string, IEnumerable<string>>(DefaultResponseHeaders);
     headers["Content-Length"] = new[] { aPageSource.ContentLength.ToString() };
     headers["Content-Type"] = new[] { aPageSource.ContentType };
     iResult(aStatus, headers, aPageSource.Serve());
 }