public void Stop()
            {
                if (hostedService != null)
                {
                    hostedService.Stop();
                }

                foreach (var stopServiceEvent in stopEvents.OrderBy(e => e.Order))
                {
                    stopServiceEvent.Execute();
                }

                using (IoC.Container) { }
                IoC.Container = null;
            }
 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.");
 }
Пример #3
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.");
        }
Пример #4
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.");
 }
Пример #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.");
        }
Пример #6
0
 protected override void OnStop()
 {
     _service.Stop();
 }