//private Dictionary<string, int> DictonarySort(Dictionary<string, int> dic) //{ // Dictionary<string, int> dicSort = from objDic in dic orderby objDic.Value select objDic; // return dicSort; //} /// <summary> /// 改变最低电量两个AGV状态的颜色为红色 /// </summary> public static void SetRedText() { IWord agv1 = DevMsg.Find(c => { return(c.Id.Equals(lowagv[0])); }); IWord agv2 = DevMsg.Find(c => { return(c.Id.Equals(lowagv[1])); }); if (agv1 != null) { agv1.IColor = Color.Red; } if (agv2 != null) { agv2.IColor = Color.Red; } }
/// <summary> /// 6.组装上方的AGV状态列表信息 /// </summary> /// <param name="list"></param> public static void UpdateDevInfo(List <DeviceBackImf> list) { lock (_obj) { InitP(); foreach (var agv in list) { if (!agv.DevType.Equals("Magnet_Basic")) { continue; } //找不到上方AGV名称的时候才去添加 if (DevMsg.Find(c => { return(c.Id.Equals(agv.DevId + 10)); }) == null) { DevMsg.Add(new IWord { Id = agv.DevId + 10, Text = agv.DevId, ILocPoint = NextPoint(), IColor = Color.Black, IFont = _font }); } //找不到上方AGV状态的时候才添加 IWord agvstatus = DevMsg.Find(c => { return(c.Id.Equals(agv.DevId + 100)); }); if (agvstatus == null) { DevMsg.Add(new IWord { Id = agv.DevId + 100, Text = GetDevStatus(agv, out color), ILocPoint = NextPoint(), IColor = color, IFont = _font }); } else { //找到对应的Iword只更新文字和颜色。避免不断新增 agvstatus.Text = GetDevStatus(agv, out color); agvstatus.IColor = color; } CompareAgv(agv); } SetRedText(); } }