You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using CommunityToolkit.Mvvm.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using MvvmAppCore.ViewModels;
|
|
using MvvmCommunityApp.services;
|
|
using MvvmAppCore.Interfaces;
|
|
using System;
|
|
using System.Windows;
|
|
|
|
namespace MvvmCommunityApp
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
public new static App Current => (App)Application.Current;
|
|
|
|
public App()
|
|
{
|
|
// !!! 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>()
|
|
.AddSingleton<MotorProfileViewModel>()
|
|
.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();
|
|
|
|
wnd.Title = "Something else";
|
|
|
|
|
|
wnd.Show();
|
|
}
|
|
}
|
|
}
|