From 071f0a41c69a6e4d1cd1f4e0cc5623c8d24381a6 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期六, 09 五月 2020 10:13:11 +0800
Subject: [PATCH] 请合并最新代码(20200509优化新风小模块,绑定新风目标和门锁失效模式弹窗机制)

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs        |    4 +-
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs       |    4 +-
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs |   80 ++++++++++++++++++++++++++++-----------
 3 files changed, 61 insertions(+), 27 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs
index 91574a2..d2cb6cd 100644
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs
@@ -128,7 +128,7 @@
             this.listControl.Add(btnHighSpeed);
             btnHighSpeed.ButtonClickEvent += (sender, e) =>
             {
-                if (FreshAirDev.currentFanMode == 15)
+                if (FreshAirDev.currentFanMode == 5)
                 {
                     var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate));
                     msgContr.Show();
@@ -172,7 +172,7 @@
             this.listControl.Add(btnLowSpeed);
             btnLowSpeed.ButtonClickEvent += (sender, e) =>
             {
-                if (FreshAirDev.currentFanMode == 15)
+                if (FreshAirDev.currentFanMode == 5)
                 {
                     var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate));
                     msgContr.Show();
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
index e52c72f..1d62a62 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
@@ -1012,31 +1012,32 @@
                         {
                             foreach (var bd in oldTargetList)
                             {
-                                var delDevice = new DelDeviceBindData();
-                                delDevice.DeviceAddr = curControlDev.DeviceAddr;
-                                delDevice.Epoint = curControlDev.DeviceEpoint;
-
-                                var removeDevice = new RemoveBindListObj();
-                                removeDevice.BindType = 0;
-                                switch (curDeviceBindType)
+                                var delDevice = DelBindDevice(bd);
+                                var delResult = new DelDeviceBindResponseAllData();
+                                delResult = await curControlDev.DelDeviceBindAsync(delDevice);
+                                if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
-                                    case 1:
-                                        removeDevice.BindCluster = 514;
-                                        break;
-                                    case 2:
-                                        removeDevice.BindCluster = 1026;
-                                        break;
-                                    case 3:
-                                        removeDevice.BindCluster = 1029;
-                                        break;
-                                    case 4:
-                                        //PM2.5
-                                        break;
+                                    if (delResult.removeBindResultResponseData.Result != 0)
+                                    {
+                                        Application.RunOnMainThread(() =>
+                                        {
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+                                            btnFinifh.Enable = true;
+                                            btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                            CommonPage.Loading.Hide();
+                                        });
+                                        return;
+                                    }
                                 }
-                                removeDevice.BindMacAddr = bd.DeviceAddr;
-                                removeDevice.BindEpoint = bd.DeviceEpoint;
-                                delDevice.RemoveBindList.Add(removeDevice);
-
+                            }
+                        }
+                        else
+                        {
+                            //妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓�
+                            //姝ゆ椂闇�瑕佸垹闄ゅ凡缁忚缁戝畾鍒扮洰鏍囷紝鎵嶈兘缁х画缁戝畾鏂扮洰鏍�
+                            if (curBindDevice != null)
+                            {
+                                var delDevice = DelBindDevice(curBindDevice);
                                 var delResult = new DelDeviceBindResponseAllData();
                                 delResult = await curControlDev.DelDeviceBindAsync(delDevice);
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
@@ -1235,6 +1236,39 @@
         }
 
         /// <summary>
+        /// 妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓�
+        /// </summary>
+        /// <returns></returns>
+        private DelDeviceBindData DelBindDevice(CommonDevice bd)
+        {
+            var delDevice = new DelDeviceBindData();
+            delDevice.DeviceAddr = curControlDev.DeviceAddr;
+            delDevice.Epoint = curControlDev.DeviceEpoint;
+
+            var removeDevice = new RemoveBindListObj();
+            removeDevice.BindType = 0;
+            switch (curDeviceBindType)
+            {
+                case 1:
+                    removeDevice.BindCluster = 514;
+                    break;
+                case 2:
+                    removeDevice.BindCluster = 1026;
+                    break;
+                case 3:
+                    removeDevice.BindCluster = 1029;
+                    break;
+                case 4:
+                    //PM2.5
+                    break;
+            }
+            removeDevice.BindMacAddr = bd.DeviceAddr;
+            removeDevice.BindEpoint = bd.DeviceEpoint;
+            delDevice.RemoveBindList.Add(removeDevice);
+            return delDevice;
+        }
+
+        /// <summary>
         /// 鑳芥樉绀虹殑鎴块棿鍒楄〃
         /// </summary>
         private List<Room> GetSupportRoomList()
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
old mode 100755
new mode 100644
index 8a521d7..89f9c6e
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -462,8 +462,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinRealAverage(60),
+                    Height = Application.GetMinRealAverage(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",

--
Gitblit v1.8.0