From 19b2404da8c1c8723bb79e58787cd37386d01139 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Tue, 9 Aug 2016 14:32:23 +0200 Subject: [PATCH] =?utf8?q?Instatiator:=20use=20loadTemplate=20instead=20of?= =?utf8?q?=20SetChild=20for=20adding=20child=20in=20TemplatedControl=20=09?= =?utf8?q?modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20=20src/CompilerServic?= =?utf8?q?es/CompilerServices.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/CompilerServices/CompilerServices.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 80b4d535..da15dbf5 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -51,11 +51,9 @@ namespace Crow reader.il.Emit (OpCodes.Ldstr, template); //Load template path string reader.il.Emit (OpCodes.Callvirt,//call Interface.Load(path) typeof(Interface).GetMethod ("Load", BindingFlags.Static | BindingFlags.Public)); - reader.il.Emit (OpCodes.Callvirt,//add child - typeof(PrivateContainer).GetMethod ("SetChild", BindingFlags.Instance | BindingFlags.NonPublic)); } - reader.il.Emit (OpCodes.Ldloc_0); - reader.il.Emit (OpCodes.Callvirt, crowType.GetMethod ("ResolveBindings")); + reader.il.Emit (OpCodes.Callvirt,//add child + typeof(TemplatedControl).GetMethod ("loadTemplate", BindingFlags.Instance | BindingFlags.NonPublic)); } } @@ -124,6 +122,11 @@ namespace Crow break; case XmlNodeType.Element: //Templates + if (reader.Name == "Template" || + reader.Name == "ItemTemplate") { + reader.Skip (); + continue; + } if (miAddChild == null) { @@ -131,6 +134,8 @@ namespace Crow miAddChild = typeof(Group).GetMethod ("AddChild"); else if (typeof(Container).IsAssignableFrom (crowType)) miAddChild = typeof(Container).GetMethod ("SetChild"); + else if (typeof(TemplatedContainer).IsAssignableFrom (crowType)) + miAddChild = typeof(TemplatedContainer).GetProperty("Content").GetSetMethod(); else if (typeof(PrivateContainer).IsAssignableFrom (crowType)) miAddChild = typeof(PrivateContainer).GetMethod ("SetChild", BindingFlags.Instance | BindingFlags.NonPublic); -- 2.47.3