Example #1
0
 protected override void OnStop()
 {
     KeepRunning = false;
     if (_InfoClient != null)
     {
         _InfoClient.Stop();
         _InfoClient = null;
     }
 }
Example #2
0
 protected override void OnStart(string[] args)
 {
     KeepRunning = true;
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         while (KeepRunning)
         {
             if (_InfoClient == null || !_InfoClient.Connected)
             {
                 _InfoClient = new WindowsService.InfoClient("192.168.0.2", 4500, 5000);
                 _InfoClient.Start();
             }
             System.Threading.Thread.Sleep(1000 * 5);// one minute reconnect interval
         }
     });
 }