Example #1
0
            public void AddList <TElement>(Func <T, IEnumerable> func, string title, Func <TElement, string> title_func, Action <BodyConfig <TElement> > columns_config)
            {
                var cfg = new ListConfig
                {
                    title      = title,
                    get_func   = (x => func((T)x)),
                    title_func = (x => title_func((TElement)x))
                };

                columns_config(new BodyConfig <TElement>(cfg.body));

                this.cfg.body.Add(cfg);
            }
Example #2
0
        private static void RenderList(object element, ListConfig list_config, XmlWriter writer)
        {
            if (!list_config.get_func(element).IsEmpty())
            {
                writer.WriteStartElement("ol");

                foreach (var item in list_config.get_func(element))
                {
                    writer.WriteStartElement("li");
                    writer.WriteString(list_config.title_func(item));

                    foreach (var body_config in list_config.body.body)
                    {
                        RenderBody(item, body_config, writer);
                    }

                    writer.WriteEndElement(); //li
                }

                writer.WriteEndElement(); //ol
            }
        }