private void Linshi_BoilerEventLog_(daima.Shebei_AD status) { NavigationService.Navigate(new shouji(status)); }
/// <summary> /// 更新设备数据 /// </summary> /// <param name="json_str">包含所有设备数据的外层JSON</param> public void Gengxin(Shuju_chuang shuju_Chuang) { //更新控制中心数据 Shuju.Zhujiming = shuju_Chuang.Kongzhi.Zhujiming; //更新设备数据 for (int i = 0; i < shuju_Chuang.shuju_Shebei_PCs.Count; i++) { Shebei_PC shebei_PC = null; //根据唯一识别号匹配设备 foreach (var item in Shebei_Fus) { if (item.Shuju.Weiyi_shibie == shuju_Chuang.shuju_Shebei_PCs[i].Weiyi_shibie) { shebei_PC = item as Shebei_PC; shebei_PC.Gengxin(shuju_Chuang.shuju_Shebei_PCs[i]); } } //未匹配到设备 if (shebei_PC == null) { shebei_PC = new Shebei_PC(); shebei_PC.Chushihua(shuju_Chuang.shuju_Shebei_PCs[i].Weiyi_shibie); Shebei_Fus.Add(shebei_PC); } shebei_PC.Gengxin(shuju_Chuang.shuju_Shebei_PCs[i]); } //更新设备数据 for (int i = 0; i < shuju_Chuang.shuju_Shebei_ADs.Count; i++) { Shebei_AD shebei_AD = null; //根据唯一识别号匹配设备 foreach (var item in Shebei_Fus) { if (item.Shuju.Weiyi_shibie == shuju_Chuang.shuju_Shebei_ADs[i].Weiyi_shibie) { shebei_AD = item as Shebei_AD; shebei_AD.Gengxin(shuju_Chuang.shuju_Shebei_ADs[i]); } } //未匹配到设备 if (shebei_AD == null) { shebei_AD = new Shebei_AD(); shebei_AD.Chushihua(shuju_Chuang.shuju_Shebei_PCs[i].Weiyi_shibie); Shebei_Fus.Add(shebei_AD); } shebei_AD.Gengxin(shuju_Chuang.shuju_Shebei_ADs[i]); } //删除已经断开连接设备 for (int k = 0; k < Shebei_Fus.Count; k++) { bool shifou_cunzai = false; //根据唯一识别号匹配设备 for (int i = 0; i < shuju_Chuang.shuju_Shebei_PCs.Count; i++) { if (Shebei_Fus[k].Shuju.Weiyi_shibie == shuju_Chuang.shuju_Shebei_PCs[i].Weiyi_shibie) { shifou_cunzai = true; break; } } for (int i = 0; i < shuju_Chuang.shuju_Shebei_ADs.Count; i++) { if (Shebei_Fus[k].Shuju.Weiyi_shibie == shuju_Chuang.shuju_Shebei_ADs[i].Weiyi_shibie) { shifou_cunzai = true; break; } } //未匹配到设备 if (shifou_cunzai == false) { Shebei_Fus.RemoveAt(k); } } }
public shouji(daima.Shebei_AD shebei_AD) { Shebei_AD_ = shebei_AD; Loaded += Kongzhi_Loaded; InitializeComponent(); }