Adding extension support for retrieving the assembly information for the type calling RegisterSetupType
This commit is contained in:
Родитель
4250ceab2e
Коммит
3ff4e5be52
|
@ -129,7 +129,7 @@ namespace MvvmCross.Droid.Support.V7.AppCompat
|
|||
|
||||
protected virtual void RegisterSetup<TMvxAndroidSetup>() where TMvxAndroidSetup : MvxAppCompatSetup, new()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxAndroidSetup>(GetType().Assembly);
|
||||
this.RegisterSetupType<TMvxAndroidSetup>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MvvmCross.Droid.Support.V7.AppCompat
|
|||
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxAndroidSetup>(GetType().Assembly);
|
||||
this.RegisterSetupType<TMvxAndroidSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,9 +98,7 @@ namespace MvvmCross.Forms.Platforms.Ios.Core
|
|||
LifetimeChanged?.Invoke(this, new MvxLifetimeEventArgs(which));
|
||||
}
|
||||
|
||||
protected virtual void RegisterSetup()
|
||||
{
|
||||
}
|
||||
protected abstract void RegisterSetup();
|
||||
|
||||
public event EventHandler<MvxLifetimeEventArgs> LifetimeChanged;
|
||||
}
|
||||
|
@ -112,7 +110,7 @@ namespace MvvmCross.Forms.Platforms.Ios.Core
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxIosSetup>();
|
||||
this.RegisterSetupType<TMvxIosSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace MvvmCross.Forms.Platforms.Mac.Core
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxMacSetup>();
|
||||
this.RegisterSetupType<TMvxMacSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace MvvmCross.Core
|
|||
{
|
||||
public static class MvxSetupExtensions
|
||||
{
|
||||
public static void RegisterSetupType<TMvxSetup>(this object platformApplication, params Assembly[] assemblies) where TMvxSetup : MvxSetup, new()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxSetup>(new[] { platformApplication.GetType().Assembly }.Union(assemblies ?? new Assembly[] { }).ToArray());
|
||||
}
|
||||
|
||||
public static TSetup CreateSetup<TSetup>(Assembly assembly, params object[] parameters) where TSetup : MvxSetup
|
||||
{
|
||||
var setupType = FindSetupType<TSetup>(assembly);
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace MvvmCross.Platforms.Android.Views
|
|||
|
||||
protected virtual void RegisterSetup<TMvxAndroidSetup>() where TMvxAndroidSetup : MvxAndroidSetup, new()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxAndroidSetup>(GetType().Assembly);
|
||||
this.RegisterSetupType<TMvxAndroidSetup>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace MvvmCross.Platforms.Android.Views
|
|||
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxAndroidSetup>(GetType().Assembly);
|
||||
this.RegisterSetupType<TMvxAndroidSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,9 +64,7 @@ namespace MvvmCross.Platforms.Ios.Core
|
|||
return null;
|
||||
}
|
||||
|
||||
protected virtual void RegisterSetup()
|
||||
{
|
||||
}
|
||||
protected abstract void RegisterSetup();
|
||||
|
||||
private void FireLifetimeChanged(MvxLifetimeEvent which)
|
||||
{
|
||||
|
@ -83,7 +81,7 @@ namespace MvvmCross.Platforms.Ios.Core
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxIosSetup>();
|
||||
this.RegisterSetupType<TMvxIosSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace MvvmCross.Platforms.Mac.Core
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxMacSetup>();
|
||||
this.RegisterSetupType<TMvxMacSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace MvvmCross.Platforms.Tvos.Core
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<TMvxTvosSetup>();
|
||||
this.RegisterSetupType<TMvxTvosSetup>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Playground.Forms.Uwp
|
|||
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<MvxFormsWindowsSetup<Core.App, FormsApp>>();
|
||||
this.RegisterSetupType<MvxFormsWindowsSetup<Core.App, FormsApp>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Playground.Uwp
|
|||
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<MvxWindowsSetup<Core.App>>();
|
||||
this.RegisterSetupType<MvxWindowsSetup<Core.App>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Playground.Wpf
|
|||
{
|
||||
protected override void RegisterSetup()
|
||||
{
|
||||
MvxSetup.RegisterSetupType<MvxWpfSetup<Core.App>>();
|
||||
this.RegisterSetupType<MvxWpfSetup<Core.App>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче