public void BuildElement(Element element) { string type = "WB.Builders." + element.GetType().Name + "Builder"; if (BuilderMap.ContainsKey(type)) { TagBuilder = BuilderMap[type]; } else { Type TagType = Type.GetType(type, false, true); if (TagType != null) { ConstructorInfo ci = TagType.GetConstructor( new Type[] { }); object Obj = ci.Invoke(new object[] { }); TagBuilder = Obj as ITagBuilder; BuilderMap.Add(type, TagBuilder);// Obj as ITagBuilder); } else { } } TagBuilder?.Build(); element.Children.ToList().ForEach(p => BuildElement(p)); }
public void Setup(Element parent, Element previous) { Parent = parent; Previous = previous; if (Parent != null && Parent.children.Count > 0) { PreviousSibling = Parent.children[Parent.children.Count - 1]; PreviousSibling.NextSibling = this; } }
internal void AddChild(Element element) { element.Parent = this; Element previous = children.ElementAtOrDefault(children.Count - 1); if (previous != null) { element.PreviousSibling = previous; previous.NextSibling = element; } children.Add(element); }