Adding extension support for retrieving the assembly information for the type calling RegisterSetupType

This commit is contained in:
Nick Randolph 2018-03-27 16:02:17 +11:00 коммит произвёл Martijn van Dijk
Родитель 4250ceab2e
Коммит 3ff4e5be52
13 изменённых файлов: 20 добавлений и 19 удалений

Просмотреть файл

@ -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,10 +98,8 @@ 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>>();
}
}
}