41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using Aufgabe17.Controllers;
|
|
using Autofac;
|
|
|
|
namespace Aufgabe17
|
|
{
|
|
public partial class App : Application
|
|
{
|
|
public IContainer Container { get; set; }
|
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
{
|
|
base.OnStartup(e);
|
|
|
|
// Hier wird die Anwendung gebaut bei start
|
|
// var mainWindow = new MainWindow()
|
|
// mainWindow.show()
|
|
|
|
// Hier wird in der Theorie der Controller erstellt
|
|
|
|
var containerBuilder = new ContainerBuilder();
|
|
|
|
containerBuilder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
|
|
.Where(t => t.IsClass && (t.Namespace.Contains("Controllers") || t.Namespace.Contains("ViewModels") || t.Namespace.Contains("Views")));
|
|
|
|
containerBuilder.RegisterInstance(this);
|
|
this.Container = containerBuilder.Build();
|
|
|
|
var instanz = this.Container.Resolve<MainWindowController>();
|
|
instanz.Initialize();
|
|
}
|
|
}
|
|
}
|