Caliburn.Micro + Startup

I have a project with Caliburn.Micro, and I'm trying to migrate from SimpleContainerto Autofac .

I am using this code , i.e. an updated version of the code in this guide . Using SimpleContainer, I just did (inside the bootloader)

protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
    this.DisplayRootViewFor<IScreen>(); // where ShellViewModel : Screen
}

Now this no longer works, so what should I do to integrate Autofac with Caliburn.Micro?

+4
source share
1 answer

There are several errors in your decision.

-, AppBootstrapper. Caliburn.Micro App.xaml. . WPF.

. App.xaml :

<Application x:Class="AutofacTests.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         xmlns:local="clr-namespace:AutofacTests">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <local:AppBootstrapper x:Key="bootstrapper" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

-, , Caliburn.Micro Autofac , ( ).

Autofac, , AssemblySource, Caliburn.Micro . . , SelectAssemblies AppBootstrapper:

protected override IEnumerable<Assembly> SelectAssemblies()
{
    return new[]
               {
                   GetType().Assembly, 
                   typeof(ShellViewModel).Assembly, 
                   typeof(ShellView).Assembly
               };
}
+2

All Articles