protected override void OnStart(string[] args) { this.Stopped.Reset(); Logger.Log(LogLevel.Info, "Starting service"); PrintProcessor = new WindowsPrintJobProcessor(); PrintProxy = new CloudPrintProxy(PrintProcessor, (p) => Stop()); InfoServer = new CloudPrintInfoServer(Config.UserAuthHttpPort, PrintProxy); InfoServer.Start(); if (PrintProxy.IsRegistered) { PrintProxy.Start(true); } Logger.Log(LogLevel.Info, "Service started"); }
protected override void OnStop() { Logger.Log(LogLevel.Info, "Stopping service"); if (InfoServer != null) { InfoServer.Dispose(); InfoServer = null; } if (PrintProxy != null) { PrintProxy.Dispose(); PrintProxy = null; } if (PrintProcessor != null) { PrintProcessor.Dispose(); PrintProcessor = null; } Logger.Log(LogLevel.Info, "Service stopped"); this.Stopped.Set(); }