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); }
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(); } }