HDL Home App 第二版本 旧平台金堂用 正在使用
xm
2020-05-19 34b65350abbb8b740b9c3bc0b43254cbbe23fcb5
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
@@ -18,16 +18,11 @@
        /// <param name="device"></param>
        /// <param name="deviceBindType">1:新风;2:温度传感器;3:湿度传感器;4:PM2.5传感器</param>
        /// <param name="bindDev">绑定目标 </param>
        public PanelFangyueFreshAirTargetsForm(CommonDevice device, CommonDevice bindDev, List<BindListResponseObj> bindList, int deviceBindType)
        public PanelFangyueFreshAirTargetsForm(CommonDevice device, CommonDevice bindDev, int deviceBindType)
        {
            this.curControlDev = device as FreshAir;
            this.curBindDevice = bindDev;
            this.curDeviceBindType = deviceBindType;
            curControlDev.bindList = bindList;
            if (bindList.Count == 0)
            {
                canReadBindList = true;
            }
        }
        #endregion
@@ -108,10 +103,7 @@
        /// PM绑定目标回调
        /// </summary>
        public Action<string> actionPMTarget = null;
        /// <summary>
        /// 是否能点击保存按钮
        /// </summary>
        private bool canReadBindList = false;
        #endregion
        #region UI设计 
@@ -340,6 +332,19 @@
                        curentOldRoom = btnRoom;
                        curentOldRoomFrameLayout = btnRoomFrameLayout;
                    }
                }
                if (index == roomTempList.Count - 1 && index > 3)
                {
                    var btnRoomFrameLayoutEmpty = new FrameLayout
                    {
                        Height = Application.GetMinReal(159),
                        Width = Application.GetMinReal(50),
                        Y = Application.GetRealHeight(23),
                        X = Application.GetRealWidth(5),
                        BorderWidth = 1,
                    };
                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
                }
                EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
@@ -722,27 +727,24 @@
                    //获取所有房间中匹配的能绑的目标
                    currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList();
                    //获取面板中存在的绑定目标
                    if (canReadBindList)
                    //获取面板中存在的绑定目标
                    var panelBindListRes = await this.curControlDev.GetDeviceBindAsync();
                    if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
                    {
                        var panelBindListRes = await this.curControlDev.GetDeviceBindAsync();
                        if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
                        curControlDev.bindList.Clear();
                        foreach (var bDev in panelBindListRes.getAllBindResponseData.BindList)
                        {
                            curControlDev.bindList.Clear();
                            foreach (var bDev in panelBindListRes.getAllBindResponseData.BindList)
                            {
                                curControlDev.bindList.Add(bDev);
                            }
                            curControlDev.bindList.Add(bDev);
                        }
                        else
                    }
                    else
                    {
                        Application.RunOnMainThread(() =>
                        {
                            Application.RunOnMainThread(() =>
                            {
                                CommonPage.Loading.Hide();
                                midVerticalScrolViewLayout.EndHeaderRefreshing();
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                            });
                        }
                            CommonPage.Loading.Hide();
                            midVerticalScrolViewLayout.EndHeaderRefreshing();
                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                        });
                    }
                    targetList.Clear();
@@ -990,12 +992,7 @@
                                            btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                                            this.RemoveFromParent();
                                        });
                                        var mainKey = delDevice.DeviceAddr + delDevice.Epoint;
                                        var dev1 = curControlDev.bindList.Find(obj => (obj != null) && (obj.BindMacAddr + obj.BindEpoint == mainKey));
                                        if (dev1 != null)
                                        {
                                            curControlDev.bindList.Remove(dev1);
                                        }
                                    }
                                    else
                                    {
@@ -1108,12 +1105,6 @@
                                        return;
                                    }
                                }
                                var mainKey = delDevice.DeviceAddr + delDevice.Epoint;
                                var dev2 = curControlDev.bindList.Find(obj => (obj != null) && (obj.BindMacAddr + obj.BindEpoint == mainKey));
                                if (dev2 != null)
                                {
                                    curControlDev.bindList.Remove(dev2);
                                }
                            }
                        }
                        else
@@ -1150,12 +1141,6 @@
                                        return;
                                    }
                                }
                                var mainKey = delDevice.DeviceAddr + delDevice.Epoint;
                                var dev3 = curControlDev.bindList.Find(obj => (obj != null) && (obj.BindMacAddr + obj.BindEpoint == mainKey));
                                if (dev3 != null)
                                {
                                    curControlDev.bindList.Remove(dev3);
                                }
                            }
                        }
@@ -1186,9 +1171,7 @@
                            addBindInfo.BindType = 0;
                            addBindInfo.BindMacAddr = de.DeviceAddr;
                            addBindInfo.BindEpoint = de.DeviceEpoint;
                            addBindeDev.BindList.Add(addBindInfo);
                            addBindeDev.BindName = de.DeviceEpointName;
                            switch (curDeviceBindType)
                            {
                                case 2:
@@ -1204,6 +1187,7 @@
                                    }
                                    break;
                            }
                            addBindeDev.BindList.Add(addBindInfo);
                        }
                        var dev = new AddedDeviceBindResponseAllData();
@@ -1259,13 +1243,6 @@
                                    btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                                    this.RemoveFromParent();
                                });
                                var mainKey = addBindeDev.DeviceAddr + addBindeDev.Epoint;
                                var dev4 = curControlDev.bindList.Find(obj => (obj != null) && (obj.BindMacAddr + obj.BindEpoint == mainKey));
                                if (dev4 != null)
                                {
                                    curControlDev.bindList.Add(dev4);
                                }
                            }
                            else if (dev.addedDeviceBindResponseData.Result == 1)
                            {