diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-07-19 01:17:29 +0200 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-07-18 16:17:29 -0700 |
commit | f304f25df2d80094d2c31fda4986f92454599a7e (patch) | |
tree | e9b9a32bea7e5f8c5e07fbcb4cabbaa5abb0c2f8 /Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs | |
parent | 272033723ea275ceb8a288fa605eafd035c79f2d (diff) | |
download | xamarin-forms-f304f25df2d80094d2c31fda4986f92454599a7e.tar.gz xamarin-forms-f304f25df2d80094d2c31fda4986f92454599a7e.tar.bz2 xamarin-forms-f304f25df2d80094d2c31fda4986f92454599a7e.zip |
[Xaml] allow the Previewer to provide their own Xaml files for any type (#262)
* [Xaml] allow the Previewer to provide their own Xaml files for any type
* [Xaml] use a Func instead of an interface, easier to use by reflection. Add tests
* [XamlC] move the InitializeComponent duplication to XamlC task
* [XamlC] generate branching code
* [XamlC] fix the XamlC issue
* [XamlC] make the API public
* [docs] fix docs
Diffstat (limited to 'Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs')
-rw-r--r-- | Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs b/Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs index bec6386d..e0f81972 100644 --- a/Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs +++ b/Xamarin.Forms.Build.Tasks/DebugXamlCTask.cs @@ -67,18 +67,11 @@ namespace Xamarin.Forms.Build.Tasks LogLine(2, "no InitializeComponent found... skipped."); continue; } - if (typeDef.Methods.FirstOrDefault(md => md.Name == "InitCompRuntime") != null) - { - LogLine(2, "InitCompRuntime already exists... skipped"); + var initCompRuntime = typeDef.Methods.FirstOrDefault(md => md.Name == "__InitComponentRuntime"); + if (initCompRuntime == null) { + LogLine(2, "no __InitComponentRuntime found... skipped."); continue; } - LogLine(2, ""); - - LogString(2, " Duplicating {0}.InitializeComponent () into {0}.InitCompRuntime ... ", typeDef.Name); - var initCompRuntime = new MethodDefinition("InitCompRuntime", initComp.Attributes, initComp.ReturnType); - initCompRuntime.Body = initComp.Body; - typeDef.Methods.Add(initCompRuntime); - LogLine(2, "done."); // IL_0000: ldarg.0 // IL_0001: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.ContentPage::'.ctor'() @@ -92,7 +85,7 @@ namespace Xamarin.Forms.Build.Tasks // IL_0013: br IL_001e // // IL_0018: ldarg.0 - // IL_0019: callvirt instance void class Xamarin.Forms.Xaml.XamlcTests.MyPage::InitCompRuntime() + // IL_0019: callvirt instance void class Xamarin.Forms.Xaml.XamlcTests.MyPage::__InitComponentRuntime() // IL_001e: ret var altCtor = |