Esempio n. 1
0
        public PageStylesheetProjection Create(IPage page, IEnumerable <IOptionValue> options)
        {
            IStylesheetAccessor jsAccessor = null;
            Type pageType;

            if (page is IProxy)
            {
                pageType = page.GetType().BaseType;
            }
            else
            {
                pageType = page.GetType();
            }

            string key = "STYLESHEETRENDERER-" + pageType.Name.ToUpperInvariant();

            if (containerProvider.CurrentScope.IsRegisteredWithKey <IStylesheetAccessor>(key))
            {
                jsAccessor = containerProvider.CurrentScope
                             .ResolveKeyed <IStylesheetAccessor>(key, new Parameter[]
                {
                    new PositionalParameter(0, page),
                    new PositionalParameter(1, options)
                });
            }

            if (jsAccessor == null)
            {
                throw new CmsException(string.Format("No page style sheet accessor was found for the page type {0}.", pageType.FullName));
            }

            var jsProjection = new PageStylesheetProjection(page, jsAccessor);

            return(jsProjection);
        }
 public PageStylesheetProjection(SerializationInfo info, StreamingContext context)
 {
     page = (IPage)info.GetValue("page", typeof(IPage));
     styleAccessor = (IStylesheetAccessor)info.GetValue("styleAccessor", typeof(IStylesheetAccessor));
 }
 public PageStylesheetProjection(IPage page, IStylesheetAccessor styleAccessor)
 {
     this.page = page;
     this.styleAccessor = styleAccessor;
 }
Esempio n. 4
0
 public PageStylesheetProjection(SerializationInfo info, StreamingContext context)
 {
     page          = (IPage)info.GetValue("page", typeof(IPage));
     styleAccessor = (IStylesheetAccessor)info.GetValue("styleAccessor", typeof(IStylesheetAccessor));
 }
Esempio n. 5
0
 public PageStylesheetProjection(IPage page, IStylesheetAccessor styleAccessor)
 {
     this.page          = page;
     this.styleAccessor = styleAccessor;
 }