Files
LaDOSE/LaDOSE.Src/LaDOSE.DesktopApp/Bootstrapper.cs
2022-03-19 23:05:19 +01:00

63 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Windows;
using System.Windows.Threading;
using Caliburn.Micro;
using LaDOSE.DesktopApp.ViewModels;
using LaDOSE.REST;
namespace LaDOSE.DesktopApp
{
public class Bootstrapper : BootstrapperBase
{
private SimpleContainer container;
public Bootstrapper()
{
Initialize();
}
protected override void Configure()
{
container = new SimpleContainer();
container.Singleton<IWindowManager, WindowManager>();
container.Singleton<RestService>();
container.PerRequest<ShellViewModel>();
}
protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
}
protected override object GetInstance(Type service, string key)
{
return container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
container.BuildUp(instance);
}
protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message, sender.ToString());
base.OnUnhandledException(sender, e);
}
}
}