From e2cd94abacc0101af8d0db7fed3a785c1a045b5d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 07 五月 2020 09:28:51 +0800 Subject: [PATCH] 上传 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs | 151 ++++++++++++++++++++++++++++++++------------------ 1 files changed, 96 insertions(+), 55 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs index b7a80c6..427baf6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs @@ -274,9 +274,17 @@ 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 { @@ -303,7 +311,7 @@ btnRoomFrameLayout.AddChidren(btnRoom); btnRoom.IsSelected = false; - if (index == 0) + if (canSelect) { btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; @@ -349,13 +357,20 @@ } 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); @@ -452,38 +467,38 @@ } 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); + } - //鏂伴闈㈡澘锛氱敱浜庣洰鏍囨病鏈夋彁渚涘垹闄ゆ帴鍙o紝鎵�浠ュ彲浠ュ彇娑堥�変腑鑳戒繚瀛� - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - }; + //鏂伴闈㈡澘锛氱敱浜庣洰鏍囨病鏈夋彁渚涘垹闄ゆ帴鍙o紝鎵�浠ュ彲浠ュ彇娑堥�変腑鑳戒繚瀛� + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + }; rowLayout.MouseUpEventHandler += hander; devicePic.MouseUpEventHandler += hander; btnBindName.MouseUpEventHandler += hander; @@ -593,7 +608,7 @@ btnFloorText.Text = dicFloorList[floorId]; //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(); + supportRoomList = GetFloorRoomList(curFloorId); if (!btnMethodText.IsSelected) { if (oldbutton != null) @@ -653,21 +668,8 @@ //鑾峰彇妤煎眰 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(); @@ -752,21 +754,56 @@ { 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(); @@ -1230,7 +1267,7 @@ /// 鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂村垪琛� /// </summary> /// <returns></returns> - private List<Room> GetFloorRoomList() + private List<Room> GetFloorRoomList(string floorId) { supportRoomList.Clear(); var supportRoomListTemp = new List<Room>(); @@ -1242,6 +1279,10 @@ { if (string.IsNullOrEmpty(room.FloorId)) { + if (room.FloorId != floorId) + { + continue; + } if (room.IsLove) { continue; -- Gitblit v1.8.0