public void Start()
            {
                IoC.Container.Install(FromAssembly.This());

                hostedService = IoC.Container.Resolve<IHostedService>();
                startEvents = IoC.Container.ResolveAll<IStartServiceEvent>();
                stopEvents = IoC.Container.ResolveAll<IStopServiceEvent>();

                foreach (var startServiceEvent in startEvents.OrderBy(e => e.Order))
                {
                    startServiceEvent.Execute();
                }

                hostedService.Start();
            }
            public void Start()
            {
                IoC.Container.Install(FromAssembly.This());

                hostedService = IoC.Container.Resolve <IHostedService>();
                startEvents   = IoC.Container.ResolveAll <IStartServiceEvent>();
                stopEvents    = IoC.Container.ResolveAll <IStopServiceEvent>();

                foreach (var startServiceEvent in startEvents.OrderBy(e => e.Order))
                {
                    startServiceEvent.Execute();
                }

                hostedService.Start();
            }
 public void Run(IHostedService service)
 {
     service.Attach(this);
     Logger.Log(string.Format("Starting service {0}...", service.Name));
     service.Start();
     Logger.Log("Service started.");
     ConsoleKeyInfo key;
     do
     {
         key = Console.ReadKey(true);
     } while (key.Key != ConsoleKey.D || key.Modifiers != ConsoleModifiers.Control);
     Logger.Log(string.Format("Stopping service {0}...", service.Name));
     service.Stop();
     Logger.Log("Service stopped.");
 }
Exemplo n.º 4
0
        public void Run(IHostedService service)
        {
            service.Attach(this);
            Logger.Log(string.Format("Starting service {0}...", service.Name));
            service.Start();
            Logger.Log("Service started.");
            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey(true);
            } while (key.Key != ConsoleKey.D || key.Modifiers != ConsoleModifiers.Control);
            Logger.Log(string.Format("Stopping service {0}...", service.Name));
            service.Stop();
            Logger.Log("Service stopped.");
        }
Exemplo n.º 5
0
 public void Run(IHostedService service)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     service.Attach(this);
     Logger.Log(string.Format("Starting service {0}...", service.Name));
     service.Start();
     Logger.Log("Service started.");
     ConsoleKeyInfo key;
     do
     {
         key = Console.ReadKey(true);
     } while (key.Key != ConsoleKey.D || key.Modifiers != ConsoleModifiers.Control);
     Logger.Log(string.Format("Stopping service {0}...", service.Name));
     service.Stop();
     Logger.Log("Service stopped.");
 }
Exemplo n.º 6
0
        public void Run(IHostedService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            service.Attach(this);
            Logger.Log(string.Format("Starting service {0}...", service.Name));
            service.Start();
            Logger.Log("Service started.");
            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey(true);
            } while (key.Key != ConsoleKey.D || key.Modifiers != ConsoleModifiers.Control);
            Logger.Log(string.Format("Stopping service {0}...", service.Name));
            service.Stop();
            Logger.Log("Service stopped.");
        }
Exemplo n.º 7
0
 protected override void OnStart(string[] args)
 {
     _service.Start();
 }