|
|
|
|
@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using MvvmCommunityApp.interfaces;
|
|
|
|
|
using MvvmCommunityApp.services;
|
|
|
|
|
using MvvmCommunityApp.viewmodels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace MvvmCommunityApp
|
|
|
|
|
@ -12,17 +13,35 @@ namespace MvvmCommunityApp
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class App : Application
|
|
|
|
|
{
|
|
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
|
|
|
public new static App Current => (App)Application.Current;
|
|
|
|
|
|
|
|
|
|
public App()
|
|
|
|
|
{
|
|
|
|
|
base.OnStartup(e);
|
|
|
|
|
// !!! Add constructor initialization HERE !!!!
|
|
|
|
|
// configure mvvm ioc
|
|
|
|
|
ConfigureServices();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConfigureServices() =>
|
|
|
|
|
// setup mvvm ioc
|
|
|
|
|
Ioc.Default.ConfigureServices(
|
|
|
|
|
new ServiceCollection()
|
|
|
|
|
.AddTransient<IocPageViewModel>()
|
|
|
|
|
.AddSingleton<IDemoService, DemoService>()
|
|
|
|
|
.AddSingleton<MainWindowViewModel>()
|
|
|
|
|
.BuildServiceProvider());
|
|
|
|
|
|
|
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnStartup(e);
|
|
|
|
|
|
|
|
|
|
// setup mvvm ioc
|
|
|
|
|
//Ioc.Default.ConfigureServices(
|
|
|
|
|
// new ServiceCollection()
|
|
|
|
|
// .AddTransient<IocPageViewModel>()
|
|
|
|
|
// .AddSingleton<IDemoService, DemoService>()
|
|
|
|
|
// .BuildServiceProvider());
|
|
|
|
|
|
|
|
|
|
// load the main / entry page
|
|
|
|
|
MainWindow wnd = new MainWindow();
|
|
|
|
|
|
|
|
|
|
|