Exemple #1
0
        public static void Start <TService>(ServiceBootstrap <TService> bootstrap) where TService : Service
        {
            var metadata = bootstrap.CreateMetadata();

            bootstrap.PreConfigureLogger();
            bootstrap.ConfigureLogger();
            bootstrap.PostConfigureLogger();

            bootstrap.PreRegisterDependencies();
            bootstrap.RegisterDependencies();
            bootstrap.PostRegisterDependencies();

            HostFactory.Run(host =>
            {
                host.UseLibLog();
                host.SetDescription(metadata.Description);
                host.SetServiceName(metadata.Name);
                host.Service <Service>(service =>
                {
                    service.WhenStarted(s => s.StartAsync().ConfigureAwait(false).GetAwaiter().GetResult());
                    service.WhenStopped(s => s.StopAsync().ConfigureAwait(false).GetAwaiter().GetResult());
                    service.ConstructUsing(() => bootstrap.GetServiceAsync().ConfigureAwait(false).GetAwaiter().GetResult());
                });
                host.StartAutomatically();
            });
        }
Exemple #2
0
        public ServiceBootstrapTest()
        {
            var builder = new ContainerBuilder();

            ServiceBootstrap.ConfigureContainer(builder);
            _container = builder.Build();
        }
Exemple #3
0
        private async void OnSplashScreenDismissed(SplashScreen sender, object args)
        {
            sender.Dismissed -= OnSplashScreenDismissed;

            ServiceBootstrap.Register(ServiceLocator.Current);

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, DoLaunchMainPage).AsTask();
        }
Exemple #4
0
        protected override void ConfigureContainer(ContainerBuilder builder)
        {
            ServiceBootstrap.ConfigureContainer(builder);

            base.ConfigureContainer(builder);
        }
Exemple #5
0
 public App()
 {
     InitializeComponent();
     ServiceBootstrap.IncludeMigrations();
 }
Exemple #6
0
 public Start_service_windows()
 {
     _bootstrap = new ServiceBootstrap(BootstrapInCodeConfiguration.Default());
 }
 public TopshelfHostEntryPoint(ServiceBootstrap bootstrap, ServiceMetadata metadata)
 {
     _bootstrap = bootstrap;
     _metadata  = metadata;
 }