xm
2020-05-06 fffd8afca5b69a592e9ba8913204f83f478e2f17
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);
                    }
                   //新风面板:由于目标没有提供删除接口,所以可以取消选中能保存
                   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;
@@ -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;