public void BindDoors(List <FloorDoor> coreDoors) { coreDoors.ForEach(x => { var dtoDoor = Doors.FirstOrDefault(d => d.DoorID == x.DoorID); dtoDoor.FloorDoorID = x.FloorDoorID; dtoDoor.FloorID = x.FloorID; dtoDoor.LocationX = x.LocationX; dtoDoor.LocationY = x.LocationY; dtoDoor.Rotation = x.Rotation; dtoDoor.Enabled = (x.FloorDoorID == 0 || x.FloorID == FloorID); }); }
public DoorListViewModel(IDoorService doorService, HubConnection connection) { _doorService = doorService; AddDoorCommand = new DelegateCommand <DoorModel>(OnAddDoor); RemoveDoorCommand = new DelegateCommand <DoorModel>(OnDeleteDoor); EditDoorCommand = new DelegateCommand <DoorModel>(OnEditDoor); _connection = connection; connection.On <DoorModel>("DeleteMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); Doors.Remove(doorItem); }); connection.On <DoorModel>("AddMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); if (doorItem == null) { Doors.Add(obj); } }); connection.On <DoorModel>("EditMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); if (doorItem != null) { doorItem.IsLocked = obj.IsLocked; doorItem.IsOpen = obj.IsOpen; doorItem.Label = obj.Label; } }); }
/// <summary> /// Get the door within the room facing the given direction. /// </summary> /// <param name="direction">The direction to look for</param> /// <returns>Returns the DoorConnectionBehaviour of the door within the room facing the given direction, otherwise returns null if no such door exists.</returns> public DoorConnectionBehaviour GetDoorFacing(Direction direction) { return(Doors.FirstOrDefault(door => door.Direction == direction)); }
public Door WinningDoor() { return(Doors.FirstOrDefault(d => d.IsWinner)); }