public void Receive(DataPackage pkgData) { //收到系统信息【采集器→主机】 DeviceStatusItem deviceStatus = new DeviceStatusItem(); byte[] dataBuffer = pkgData.PureData; using (MemoryStream ms = new MemoryStream(dataBuffer)) { using (BinaryReader br = new BinaryReader(ms)) { deviceStatus.Time.Buffer = br.ReadBytes(7); deviceStatus.TH.Buffer = br.ReadBytes(4); deviceStatus.Status_D0 = br.ReadByte(); deviceStatus.Status_D1 = br.ReadByte(); deviceStatus.Status_D2 = br.ReadByte(); deviceStatus.Status_D3 = br.ReadByte(); deviceStatus.Status_D4 = br.ReadByte(); } } if (OnDataChanged != null) { DataHandlerEventArgs eventArgs = new DataHandlerEventArgs(); eventArgs.CMD_ID = pkgData.CtrlHead.CMD_ID; eventArgs.Value = deviceStatus; OnDataChanged(this, eventArgs); } }
void UpdateDeviceStatus(DeviceStatusItem deviceStatus) { //更新状态显示 if (deviceStatus == null) return; deviceStatus.UpdateDetail(); UpdateTreeList(treeList1, deviceStatus.Status_D0_List); UpdateTreeList(treeList2, deviceStatus.Status_D1_List); UpdateTreeList(treeList3, deviceStatus.Status_D2_List); UpdateTreeList(treeList4, deviceStatus.Status_D3_List); UpdateTreeList(treeList5, deviceStatus.Status_D4_List); }