| | |
| | | FrameLayout curentOldRoomFrameLayout = null; |
| | | int index = 0; |
| | | var roomTempList = GetSupportRoomList(); |
| | | Room slectedRoom = null; |
| | | |
| | | for (int i = 0; i < roomTempList.Count; i++) |
| | | { |
| | | var room = roomTempList[i]; |
| | | bool canSelect = false; |
| | | if (curControlDev.currentSelectRoomId == room.Id) |
| | | { |
| | | slectedRoom = room; |
| | | canSelect = true; |
| | | } |
| | | //房间 |
| | | var btnRoomFrameLayout = new FrameLayout |
| | | { |
| | |
| | | btnRoomFrameLayout.AddChidren(btnRoom); |
| | | |
| | | btnRoom.IsSelected = false; |
| | | if (index == 0) |
| | | if (canSelect) |
| | | { |
| | | btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; |
| | | btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; |
| | |
| | | } |
| | | BindInfo.FinishDisplay(roomTempList, btnFinifh); |
| | | |
| | | if (roomTempList.Count != 0) |
| | | if (roomTempList.Count == 0) |
| | | { |
| | | curRoom = roomTempList[0]; |
| | | curRoom = new Shared.Common.Room(); |
| | | } |
| | | else |
| | | { |
| | | curRoom = new Shared.Common.Room(); |
| | | if (slectedRoom == null) |
| | | { |
| | | curRoom = roomTempList[0]; |
| | | } |
| | | else |
| | | { |
| | | curRoom = slectedRoom; |
| | | } |
| | | } |
| | | |
| | | RefreshDeviceList(curRoom); |
| | |
| | | } |
| | | |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | btnChoose.IsSelected = !btnChoose.IsSelected; |
| | | if (!btnChoose.IsSelected) |
| | | { |
| | | if (oldDevice != null) |
| | | { |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | } |
| | | oldDevice = btnChoose; |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | targetList.Clear(); |
| | | } |
| | | else |
| | | { |
| | | if (oldDevice != null) |
| | | { |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | } |
| | | oldDevice = btnChoose; |
| | | oldDevice.IsSelected = true; |
| | | oldDevice.Visible = true; |
| | | targetList.Clear(); |
| | | targetList.Add(device); |
| | | } |
| | | { |
| | | btnChoose.IsSelected = !btnChoose.IsSelected; |
| | | if (!btnChoose.IsSelected) |
| | | { |
| | | if (oldDevice != null) |
| | | { |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | } |
| | | oldDevice = btnChoose; |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | targetList.Clear(); |
| | | } |
| | | else |
| | | { |
| | | if (oldDevice != null) |
| | | { |
| | | oldDevice.IsSelected = false; |
| | | oldDevice.Visible = false; |
| | | } |
| | | oldDevice = btnChoose; |
| | | oldDevice.IsSelected = true; |
| | | oldDevice.Visible = true; |
| | | targetList.Clear(); |
| | | targetList.Add(device); |
| | | } |
| | | |
| | | //新风面板:由于目标没有提供删除接口,所以可以取消选中能保存 |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | }; |
| | | //新风面板:由于目标没有提供删除接口,所以可以取消选中能保存 |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | }; |
| | | rowLayout.MouseUpEventHandler += hander; |
| | | devicePic.MouseUpEventHandler += hander; |
| | | btnBindName.MouseUpEventHandler += hander; |
| | |
| | | btnFloorText.Text = dicFloorList[floorId]; |
| | | |
| | | //获取楼层中房间列表 |
| | | supportRoomList = GetFloorRoomList(); |
| | | supportRoomList = GetFloorRoomList(curFloorId); |
| | | if (!btnMethodText.IsSelected) |
| | | { |
| | | if (oldbutton != null) |
| | |
| | | |
| | | //获取楼层 |
| | | dicFloorList = HdlRoomLogic.Current.GetFloorSortList(); |
| | | curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); |
| | | if (BindInfo.GetCurrentSelectFloorIdName() != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName(); |
| | | }); |
| | | } |
| | | |
| | | //获取楼层中房间列表 |
| | | supportRoomList = GetFloorRoomList(); |
| | | if (supportRoomList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | supportRoomList = GetFloorRoomList(curControlDev.currentSelectFloorId); |
| | | |
| | | //获取所有房间中匹配的能绑的目标 |
| | | currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (supportRoomList.Count != 0) |
| | | { |
| | | RefreshRoomList(); |
| | | } |
| | | |
| | | //首次是否能点击保存 |
| | | if (targetList.Count == 0) |
| | | { |
| | | curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); |
| | | if (BindInfo.GetCurrentSelectFloorIdName() != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName(); |
| | | }); |
| | | } |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | foreach (var dev in targetList) |
| | | { |
| | | //获取本地设备列表 |
| | | var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; |
| | | var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); |
| | | if (tempDev != null) |
| | | { |
| | | //获取设备所属房间 |
| | | var tempDevRoom = HdlRoomLogic.Current.GetRoomByDevice(tempDev); |
| | | if (tempDevRoom != null) |
| | | { |
| | | curControlDev.currentSelectRoomId = tempDevRoom.Id; |
| | | curControlDev.currentSelectFloorId = tempDevRoom.FloorId; |
| | | } |
| | | } |
| | | } |
| | | if (!string.IsNullOrEmpty(curControlDev.currentSelectFloorId)) |
| | | { |
| | | if (BindInfo.GetBindTargetsFloorIdName(curControlDev.currentSelectFloorId) != null) |
| | | { |
| | | btnFloorText.Text = BindInfo.GetBindTargetsFloorIdName(curControlDev.currentSelectFloorId); |
| | | } |
| | | } |
| | | |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | |
| | | |
| | | //获取楼层中房间列表 |
| | | if (supportRoomList.Count != 0) |
| | | { |
| | | RefreshRoomList(); |
| | | } |
| | | |
| | | CommonPage.Loading.Hide(); |
| | |
| | | /// 获取楼层对应的房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private List<Room> GetFloorRoomList() |
| | | private List<Room> GetFloorRoomList(string floorId) |
| | | { |
| | | supportRoomList.Clear(); |
| | | var supportRoomListTemp = new List<Room>(); |
| | |
| | | { |
| | | if (string.IsNullOrEmpty(room.FloorId)) |
| | | { |
| | | if (room.FloorId != floorId) |
| | | { |
| | | continue; |
| | | } |
| | | if (room.IsLove) |
| | | { |
| | | continue; |