Example #1
0
 public Page()
 {
     foreach (Type t in from t in Assembly.GetExecutingAssembly().GetTypes()
              where
              !t.IsAbstract && t.IsClass && t.GetInterfaces().Contains(typeof(IDynamicTemplate))
              select t)
     {
         IDynamicTemplate item = (IDynamicTemplate)t.GetConstructor(new Type[] { }).Invoke(null);
         item.CurrentPage = this;
         templates.Add(item.Name, item);
     }
 }
Example #2
0
        protected string ApplyNav()
        {
            IDynamicTemplate t   = templates["nav"];
            string           nav = "";

            foreach (Page p in PageHandler.Pages)
            {
                if (p.PageName != "")
                {
                }
                nav += t.ApplyTemplate(p, p.PageName);
            }
            return(nav);
        }
Example #3
0
        public DynamicTemplateContainer Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
        {
            var dynamicTemplateContainer = new DynamicTemplateContainer();
            var count     = 0;
            var formatter = formatterResolver.GetFormatter <DynamicTemplate>();

            while (reader.ReadIsInArray(ref count))
            {
                var              objectCount = 0;
                string           name        = null;
                IDynamicTemplate template    = null;
                while (reader.ReadIsInObject(ref objectCount))
                {
                    name     = reader.ReadPropertyName();
                    template = formatter.Deserialize(ref reader, formatterResolver);
                }

                dynamicTemplateContainer.Add(name, template);
            }

            return(dynamicTemplateContainer);
        }