I worked on Simple Injector and Caliburn micro , but almost 2 years have passed. Now today, when I tried to create a simple WPF application. First I finish reading the documentation, as both libraries have made a lot of changes.
I ran into several problems, such as the "view cannot be found", which will later resolve, but now I'm stuck in a strange problem. I tried to turn on the recorder and that’s all, but I don’t know if there is a Caliburn microchip problem or a simple injector.
Here is my bootstrap class:
internal class AppBootstrapper : BootstrapperBase
{
public static readonly Container ContainerInstance = new Container();
public AppBootstrapper()
{
LogManager.GetLog = type => new DebugLogger(type);
Initialize();
}
protected override void Configure()
{
ContainerInstance.Register<IWindowManager, WindowManager>();
ContainerInstance.RegisterSingleton<IEventAggregator, EventAggregator>();
ContainerInstance.Register<MainWindowViewModel, MainWindowViewModel>();
ContainerInstance.Verify();
}
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
DisplayRootViewFor<MainWindowViewModel>();
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return ContainerInstance.GetAllInstances(service);
}
protected override object GetInstance(System.Type service, string key)
{
return ContainerInstance.GetInstance(service);
}
protected override IEnumerable<Assembly> SelectAssemblies()
{
return new[] {
Assembly.GetExecutingAssembly()
};
}
protected override void BuildUp(object instance)
{
var registration = ContainerInstance.GetRegistration(instance.GetType(), true);
registration.Registration.InitializeInstance(instance);
}
}
Not sure what I'm missing here?