Ejemplo n.º 1
0
 internal static void StartService()
 {
     Log.Info("Starting in Service mode");
     Service = new Service();
     Service.OnServiceStop += (sender, args) => Stop(false);
     var services = new ServiceBase[] { Service };
     ServiceBase.Run(services);
 }
Ejemplo n.º 2
0
 internal static void StartServiceCommandLine()
 {
     Log.Info("Starting in CommandLine mode");
     using (Service = new Service())
     {
         KeepRunning = true;
         Service.Start();
         Service.OnServiceStop += (sender, args) => Stop(false);
         Console.WriteLine("Press 'q' to quit");
         while (KeepRunning)
         {
             if (!Local && Console.KeyAvailable && Console.ReadKey().Key == ConsoleKey.Q) break;
             Thread.Sleep(100);
         }
         Stop();
     }
 }