public static IActorApplicationBuilder UseAvalonia <TMainWindow>(this IActorApplicationBuilder hostBuilder,
                                                                         Action <AvaloniaConfiguration>?config = null)
            where TMainWindow : class, IMainWindow
        {
            hostBuilder.ConfigureAutoFac(sc =>
            {
                sc.RegisterModule <AvaloniaModule>();

                sc.RegisterType <TMainWindow>().As <IMainWindow>().SingleInstance();

                var avaloniaConfiguration = new AvaloniaConfiguration(sc);
                config?.Invoke(avaloniaConfiguration);
            });

            return(hostBuilder);
        }
示例#2
0
 public static IActorApplicationBuilder AddModule <TModule>(this IActorApplicationBuilder builder)
     where TModule : Module, new()
 => builder.ConfigureAutoFac(cb => cb.RegisterModule <TModule>());