protected override void OnStart(string[] args) { Util.SetupLogging(); Config.LoadConfig(); Management.ReadJobs(); _lpdListener = new LpdListener(); _lpdListener.NewJobReceived += (sender, newJobInfo) => Management.AddJob(newJobInfo); _lpdListener.Start(); _httpListener = new HttpListenerResponder(Config.HttpListenPort); _httpListener.Start(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { Util.SetupLogging(); StopSemaphore = new Semaphore(0, 1); Console.CancelKeyPress += Stop; Config.LoadConfig(); Management.ReadJobs(); var lpdListener = new LpdListener(); lpdListener.NewJobReceived += (sender, newJobInfo) => Management.AddJob(newJobInfo); lpdListener.Start(); var httpListener = new HttpListenerResponder(Config.HttpListenPort); httpListener.Start(); // wait StopSemaphore.WaitOne(); httpListener.Stop(); lpdListener.Stop(); }