From 34b65350abbb8b740b9c3bc0b43254cbbe23fcb5 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 19 五月 2020 09:31:44 +0800
Subject: [PATCH] 合并代码,更改面板目标信息

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs |   29 ++-------
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs             |   35 ++---------
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs       |   72 ++++++------------------
 3 files changed, 30 insertions(+), 106 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
index f7ac7c2..50ed3c5 100644
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
@@ -166,22 +166,6 @@
             btnPmUnit.TextAlignment = TextAlignment.CenterLeft;
             framePmPic.AddChidren(btnPmUnit);
             this.listControl.Add(btnPmUnit);
-
-            frameHumidityPic.MouseUpEventHandler += (sender, e) =>
-            {
-                pMSensor.currentPmData = 35;
-                UpdateStatus();
-            };
-            frameTemperaturePic.MouseUpEventHandler += (sender, e) =>
-            {
-                pMSensor.currentPmData = 99;
-                UpdateStatus();
-            };
-            framePmPic.MouseUpEventHandler += (sender, e) =>
-            {
-                pMSensor.currentPmData = 100;
-                UpdateStatus();
-            };
         }
         #endregion
 
@@ -281,16 +265,13 @@
 
                 if (pMSensor.currentPmData < 10)
                 {
-                    this.listControl[2].Width = Application.GetRealWidth(193 - 70);
+                    this.listControl[2].Width = Application.GetRealWidth(188 - 70);
                     this.listControl[3].X = Application.GetRealWidth(180 - 70);
                 }
                 else
                 {
                     this.listControl[2].Width = Application.GetRealWidth(193 - 40);
-                    this.listControl[3].X = Application.GetRealWidth(153 - 25);
-
-                    this.listControl[2].BackgroundColor = 0xff00ff00;
-                    this.listControl[3].BackgroundColor = 0xff00ffff;
+                    this.listControl[3].X = Application.GetRealWidth(137);
                 }
             }
 
@@ -298,7 +279,7 @@
             {
                 curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
                 this.listControl[2].Width = Application.GetRealWidth(193 - 40);
-                this.listControl[3].X = Application.GetRealWidth(153 - 25);
+                this.listControl[3].X = Application.GetRealWidth(137);
             }
             else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75)
             {
@@ -307,16 +288,12 @@
                 if (pMSensor.currentPmData < 100)
                 {
                     this.listControl[2].Width = Application.GetRealWidth(193 - 40);
-                    this.listControl[3].X = Application.GetRealWidth(153 - 25);
-                    this.listControl[2].BackgroundColor = 0xff00ff00;
-                    this.listControl[3].BackgroundColor = 0xff00ffff;
+                    this.listControl[3].X = Application.GetRealWidth(137);
                 }
                 else
                 {
                     this.listControl[2].Width = Application.GetRealWidth(162);
                     this.listControl[3].X = Application.GetRealWidth(153);
-                    this.listControl[2].BackgroundColor = 0xff00ff00;
-                    this.listControl[3].BackgroundColor = 0xff00ffff;
                 }
             }
             else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115)
@@ -340,8 +317,8 @@
             else
             {
                 curQuality = "";
-                this.listControl[2].Width = Application.GetRealWidth(0);
-                this.listControl[3].Gravity = Gravity.CenterHorizontal;
+                this.listControl[2].Width = Application.GetRealWidth(162);
+                this.listControl[3].X = Application.GetRealWidth(153);
             }
             //璁剧疆鐘舵�佹枃瀛�
             return curQuality;
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
index de21c0e..9e91845 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
@@ -208,7 +208,7 @@
 
             rowNewWind.ButtonClickEvent += (sender, e) =>
             {
-                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindFreshAirDev, bindList, 1);
+                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindFreshAirDev, 1);
                 Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage);
                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                 addDevicePage.Show();
@@ -283,7 +283,6 @@
                             {
                                 bindTemperatureName = bDev.ESName;
                             }
-
                             bindTemperatureDev = device;
                         }
                         if (bD.SensorDiv == 2)
@@ -317,28 +316,12 @@
                     {
                         if (bDev.BindCluster == 1026)
                         {
-                            if (string.IsNullOrEmpty(bDev.ESName))
-                            {
-                                bindTemperatureName = device.DeviceEpointName;
-                            }
-                            else
-                            {
-                                bindTemperatureName = bDev.ESName;
-                            }
-
+                            bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                             bindTemperatureDev = device;
                         }
                         if (bDev.BindCluster == 1029)
                         {
-                            if (string.IsNullOrEmpty(bDev.ESName))
-                            {
-                                bindHumidityName = device.DeviceEpointName;
-                            }
-                            else
-                            {
-                                bindHumidityName = bDev.ESName;
-                            }
-
+                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
                             bindHumidityDev = device;
                         }
                         if (bDev.BindCluster == 1066)
@@ -383,7 +366,7 @@
             var btnPMStatu = rowPM.AddMostRightView(msg, 700);
             rowPM.ButtonClickEvent += (sender, e) =>
             {
-                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindPMDev, bindList, 4);
+                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindPMDev, 4);
                 Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage);
                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                 addDevicePage.Show();
@@ -428,7 +411,7 @@
             var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700);
             rowTemPerature.ButtonClickEvent += (sender, e) =>
             {
-                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindTemperatureDev, bindList, 2);
+                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindTemperatureDev, 2);
                 Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage);
                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                 addDevicePage.Show();
@@ -473,7 +456,7 @@
             var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700);
             rowHumidity.ButtonClickEvent += (sender, e) =>
             {
-                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindHumidityDev, bindList, 3);
+                var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindHumidityDev, 3);
                 Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage);
                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                 addDevicePage.Show();
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
index 9e71acc..4a878f5 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
+++ b/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璁捐 
@@ -735,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();
@@ -1003,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
                                     {
@@ -1121,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
@@ -1163,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);
-                                }
                             }
                         }
 
@@ -1199,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:
@@ -1217,6 +1187,7 @@
                                     }
                                     break;
                             }
+                            addBindeDev.BindList.Add(addBindInfo);
                         }
 
                         var dev = new AddedDeviceBindResponseAllData();
@@ -1272,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)
                             {

--
Gitblit v1.8.0