77 lines
2.2 KiB
C#
77 lines
2.2 KiB
C#
using Caliburn.Micro;
|
|
using ImageHandlingLibrary;
|
|
using ImageHandlingLibrary.InterFaces;
|
|
using ImageHandlingUI.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace ImageHandlingUI
|
|
{
|
|
public class Bootstrapper : BootstrapperBase
|
|
{
|
|
// implementing SimpleContainer (dependency injection system in Caliburn micro)
|
|
private SimpleContainer _container = new SimpleContainer();
|
|
|
|
public Bootstrapper()
|
|
{
|
|
Initialize();
|
|
}
|
|
|
|
// implementing SimpleContainer (dependency injection system in Caliburn micro)
|
|
//
|
|
protected override void Configure()
|
|
{
|
|
_container.Instance(_container);
|
|
|
|
_container
|
|
.Singleton<IWindowManager, WindowManager>()
|
|
.Singleton<IEventAggregator, EventAggregator>();
|
|
|
|
_container
|
|
.PerRequest<IRegistring, Registring>()
|
|
.PerRequest<IFiling, Filing>();
|
|
|
|
GetType().Assembly.GetTypes()
|
|
.Where(type => type.IsClass)
|
|
.Where(type => type.Name.EndsWith("ViewModel"))
|
|
.ToList()
|
|
.ForEach(viewModelType => _container.RegisterPerRequest(
|
|
viewModelType, viewModelType.ToString(), viewModelType));
|
|
|
|
|
|
|
|
}
|
|
//
|
|
// implementing SimpleContainer (dependency injection system in Caliburn micro)
|
|
|
|
protected override void OnStartup(object sender, StartupEventArgs e)
|
|
{
|
|
DisplayRootViewFor<ShellViewModel>();
|
|
}
|
|
|
|
// implementing SimpleContainer (dependency injection system in Caliburn micro)
|
|
//
|
|
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);
|
|
}
|
|
//
|
|
// implementing SimpleContainer (dependency injection system in Caliburn micro)
|
|
|
|
}
|
|
}
|