/// <summary> /// 更换当前区域下,门的开关状态 /// </summary> /// <param name="state"></param> private void PushDoorStateInfo(DoorAccessState state) { DoorAccessState door = DoorStateList.Find(i => i.DoorId == state.DoorId && i.Dev.Id == state.Dev.Id); if (door != null) { door.Abutment_CardState = state.Abutment_CardState; } else { DoorStateList.Add(state); } if (FactoryDepManager.currentDep == null) { return; } string parentId = state.Dev.ParentId.ToString(); if (IsDepDev(FactoryDepManager.currentDep, parentId)) { DevNode dev = RoomFactory.Instance.GetCreateDevById(state.Dev.DevID, int.Parse(parentId)); if (dev != null) { DoorAccessDevController doorAccess = dev as DoorAccessDevController; if (doorAccess) { DoorAccessItem doorItem = doorAccess.DoorItem; if (doorItem == null) { Log.Error("DoorAccessManage.PushDoorStateInfo.DoorAcessItem is null:" + doorAccess.Info == null? "devinfo id is null":doorAccess.Info.Id.ToString()); return; } doorItem.ChangeDoorState(state); if (!DepDoorList.Contains(doorItem)) { DepDoorList.Add(doorItem); } } } } }
/// <summary> /// 显示当前区域门的状态 /// </summary> /// <param name="currentDep"></param> private void ShowDepDoors(DepNode currentDep) { List <DoorAccessState> doorStates = DoorStateList.FindAll(dev => dev.Dev.ParentId == currentDep.NodeID); if (doorStates != null && doorStates.Count != 0) { foreach (var door in doorStates) { DevNode dev = RoomFactory.Instance.GetCreateDevById(door.Dev.DevID, (int)door.Dev.ParentId); DoorAccessDevController devController = dev as DoorAccessDevController; if (devController != null) { DoorAccessItem doorItem = devController.DoorItem; doorItem.ChangeDoorState(door); if (!DepDoorList.Contains(doorItem)) { DepDoorList.Add(doorItem); } } } } }