private static void RunInDebugMode() { ConfigureDebugLogging(); Console.WriteLine("Running in debug"); var deviceMonitor = new DeviceMonitor(ConfigurationManager.ConnectionStrings["MetroMonitorData"].ConnectionString); deviceMonitor.Initialise(); deviceMonitor.Start(); Console.WriteLine("Press <enter> to stop or 'cls' and <enter> to clear the log"); while (true) { var command = Console.ReadLine() ?? ""; switch (command) { case "cls": Console.Clear(); break; default: deviceMonitor.Stop(); return; } } }
protected override void OnStart(string[] args) { Logger.Info(i => i("Initialising Device Monitor")); _deviceMonitor = new DeviceMonitor(ConfigurationManager.ConnectionStrings["MetroMonitorData"].ConnectionString); _deviceMonitor.Initialise(); _deviceMonitor.Start(); Logger.Info(i => i("Service Successfully Started")); }