Fix order of initialization in MvxSetup

This commit is contained in:
Tomasz Cielecki 2017-07-17 14:28:14 +02:00
Родитель 7a4b6f05f2
Коммит 1e877a978c
4 изменённых файлов: 13 добавлений и 24 удалений

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

@ -32,12 +32,10 @@ namespace MvvmCross.Forms.Droid
return _viewAssemblies;
}
protected override IMvxViewModelLocatorCollection InitializeApp(IMvxPluginManager pluginManager)
protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
{
var collection = base.InitializeApp(pluginManager);
base.InitializeApp(pluginManager, app);
_viewAssemblies.AddRange(GetViewModelAssemblies());
return collection;
}
public MvxFormsApplication FormsApplication

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

@ -34,11 +34,10 @@ namespace MvvmCross.Forms.Uwp
return _viewAssemblies;
}
protected override IMvxViewModelLocatorCollection InitializeApp(IMvxPluginManager pluginManager)
protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
{
var collection = base.InitializeApp(pluginManager);
base.InitializeApp(pluginManager, app);
_viewAssemblies.AddRange(GetViewModelAssemblies());
return collection;
}
private MvxFormsApplication _formsApplication;

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

@ -36,11 +36,10 @@ namespace MvvmCross.Forms.iOS
return _viewAssemblies;
}
protected override IMvxViewModelLocatorCollection InitializeApp(IMvxPluginManager pluginManager)
protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
{
var collection = base.InitializeApp(pluginManager);
base.InitializeApp(pluginManager, app);
_viewAssemblies.AddRange(GetViewModelAssemblies());
return collection;
}
public MvxFormsApplication FormsApplication {

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

@ -74,12 +74,15 @@ namespace MvvmCross.Core.Platform
InitializeCommandHelper();
MvxTrace.Trace("Setup: PluginManagerFramework start");
var pluginManager = InitializePluginFramework();
MvxTrace.Trace("Setup: App start");
var app = InitializeApp(pluginManager);
MvxTrace.Trace("Setup: Create App");
var app = CreateApp();
Mvx.RegisterSingleton(app);
MvxTrace.Trace("Setup: NavigationService");
InitializeNavigationService(app);
MvxTrace.Trace("Setup: Load navigation routes");
LoadNavigationServiceRoutes();
MvxTrace.Trace("Setup: App start");
InitializeApp(pluginManager, app);
MvxTrace.Trace("Setup: ViewModelTypeFinder start");
InitializeViewModelTypeFinder();
MvxTrace.Trace("Setup: ViewsContainer start");
@ -239,21 +242,11 @@ namespace MvvmCross.Core.Platform
{
}
protected virtual IMvxViewModelLocatorCollection InitializeApp(IMvxPluginManager pluginManager)
protected virtual void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
{
var app = CreateAndInitializeApp(pluginManager);
Mvx.RegisterSingleton(app);
Mvx.RegisterSingleton<IMvxViewModelLocatorCollection>(app);
return app;
}
protected virtual IMvxApplication CreateAndInitializeApp(IMvxPluginManager pluginManager)
{
var app = CreateApp();
app.LoadPlugins(pluginManager);
app.Initialize();
return app;
Mvx.RegisterSingleton<IMvxViewModelLocatorCollection>(app);
}
protected virtual void InitializeViewsContainer()