protected override void OnStart(string[] args) { try { //LogHelper.Write("[START:BEGIN] Starting service...", "GatewayService.OnStart"); if (!UDPProcess.IsRunning) { UDPProcess.Start(); //LogHelper.Write("[START:RESULT] Service is started", "GatewayService.OnStart"); } } catch (Exception ex) { //LogHelper.Write(ex, "GatewayService.OnStart"); knote.utils.ShutdownSignal.Set(); } finally { //LogHelper.Write("[START:END] Starting service.", "GatewayService.OnStart"); if (!UDPProcess.IsRunning) { knote.utils.ShutdownSignal.Set(); } } }
protected override void OnStop() { try { //LogHelper.Write("[STOP:BEGIN] Stopping service...", "GatewayService.OnStop"); if (UDPProcess.IsRunning) { UDPProcess.Stop(); //LogHelper.Write("[STOP:RESULT] Service is stopped", "GatewayService.OnStop"); } } catch (Exception ex) { //LogHelper.Write(ex, "GatewayService.OnStop"); knote.utils.ShutdownSignal.Set(); } finally { //LogHelper.Write("[STOP:END] Stopping service.", "GatewayService.OnStop"); knote.utils.ShutdownSignal.Set(); } }