private void GenerateControl(Control Parent, ILeaf <t1, t2, t3> TreeLeaf) { if (TreeLeaf is EndLeaf <t1, t2, t3> ) { this.GenerateEndLeafControl(Parent, TreeLeaf as EndLeaf <t1, t2, t3>); } else { ITemplate template = this.TemplateLookup(TreeLeaf.GetType()); if (template == null) { Parent.Controls.Add(new Label() { Text = TreeLeaf.Formula }); } else { this.GenerateFromTemplate(Parent, template, TreeLeaf); } } }