diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-09 14:32:23 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-09 14:32:23 +0200 |
| commit | 19b2404da8c1c8723bb79e58787cd37386d01139 (patch) | |
| tree | 087cff9789212c02a027df72f63e67af9c3dc23b /src/CompilerServices | |
| parent | 09069c1f3cd033c93fe2a5dbd97134155e35d877 (diff) | |
Instatiator: use loadTemplate instead of SetChild for adding child in TemplatedControl
modifié : src/CompilerServices/CompilerServices.cs
Diffstat (limited to 'src/CompilerServices')
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 13 |
1 files 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); |