/// <summary> /// Get information about robot status /// </summary> /// <param name="token"></param> private void SendInformation(CancellationToken token) { Task.Factory.StartNew(() => { while (true) { if (token.IsCancellationRequested) { break; } try { Tuple <bool, List <char[]> > data = robotManager.GetRobotData(); if (data != null && !data.Item1) { if (!string.IsNullOrEmpty(data.Item2[1][0].ToString())) { SendToClientMessage(string.Format("/running:{0}", data.Item2[1][0])); Thread.Sleep(500); } SendToClientMessage(string.Format("/status:{0},{1},{2}", new string(data.Item2[0]), new string(data.Item2[16]), new string(data.Item2[32]))); Thread.Sleep(500); } } catch (Exception ex) { logger.Error(ex.Message); } Thread.Sleep(500); } }); }