// 响应客户端的事件 private void DefaultUpCastEventHandler(string msg) { // 接收并提取信息 CommObj commObj = CommObj.FromJson(msg); XYZ xyz = new XYZ(0, 0, 0); if (commObj == null) { serverComm.RcvMsg = "Json解析错误"; } else { commObj.RcvTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); serverComm.RcvMsg = commObj.ToString(); if (commObj.DataType.Equals("XYZ")) { xyz = JsonConvert.DeserializeObject <XYZ>(commObj.DataBody); } BroadCastMessage(msg); } // UI线程安全,监控,日志 new Thread(Check).Start(); }
// 开启客户端 // 结束客户端 // 响应广播信息 public void OnBroadCastingInfo(string message) { CommObj commObj = CommObj.FromJson(message); if (commObj == null) { visComm.RcvMsg = "Json解析错误"; } else { commObj.RcvTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); visComm.RcvMsg = commObj.ToString(); } new Thread(Check).Start(); log.Info("BroadCastingMessage--" + visComm.RcvMsg); }
// 响应广播信息 public void BroadCastingMessage(string message) { CommObj commObj = CommObj.FromJson(message); if (commObj == null) { rcvMsg = "Json解析错误"; } else { commObj.RcvTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); rcvMsg = commObj.ToString(); } new Thread(Check).Start(); ILog log = log4net.LogManager.GetLogger("server.Logging"); log.Info("BroadCastingMessage--" + rcvMsg); }
public void OnBroadCastingInfo(string message) { CommObj commObj = CommObj.FromJson(message); if (commObj == null) { moverComm.RcvMsg = "Json解析错误"; } else { commObj.RcvTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); moverComm.RcvMsg = commObj.ToString(); ProcessBroadCastingInfo(commObj); } new Thread(Check).Start(); moverLog.DisplayBroadCastInfo(moverComm.RcvMsg); }
// 响应客户端的事件 public void OnUpCastEvent(string msg) { CommObj commObj = CommObj.FromJson(msg); if (commObj == null) { rcvMsg = "Json解析错误"; } else { commObj.RcvTime = DateTimeNowFmt1(); rcvMsg = commObj.ToString(); } //lbMonitor.Items.Add(rcvMsg); new Thread(Check).Start(); ILog log = log4net.LogManager.GetLogger("server.Logging"); log.Info("OnUpCastEvent--" + rcvMsg); }