From ef0c6b76b06590b38f6e87d1e4efb35b81374502 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 25 五月 2020 09:49:02 +0800
Subject: [PATCH] 请合并代码,优化逻辑执行提示和撤销门锁定时功能。

---
 ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs |   66 ++++++++++++++++++++++++++++----
 1 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
old mode 100755
new mode 100644
index 1540752..1bceb2e
--- a/ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
+++ b/ZigbeeApp20200519/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
@@ -727,8 +727,8 @@
                     //鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣
                     currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList();
 
-                    //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 
-                    var panelBindListRes = await this.curControlDev.GetDeviceBindAsync();
+                    //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣
+                    var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev);
                     if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
                     {
                         curControlDev.bindList.Clear();
@@ -953,7 +953,7 @@
                                 delDevice.RemoveBindList.Add(removeDevice);
 
                                 var delResult = new DelDeviceBindResponseAllData();
-                                delResult = await curControlDev.DelDeviceBindAsync(delDevice);
+                                delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
                                     if (delResult.removeBindResultResponseData.Result == 0)
@@ -1079,8 +1079,9 @@
                             {
                                 var delDevice = DelBindDevice(bd);
                                 var delResult = new DelDeviceBindResponseAllData();
-                                delResult = await curControlDev.DelDeviceBindAsync(delDevice);
-                                if (delResult == null || delResult.removeBindResultResponseData == null)
+                                delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
+
+                                if (delResult == null)
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
@@ -1090,6 +1091,29 @@
                                         CommonPage.Loading.Hide();
                                     });
                                     return;
+                                }
+                                else
+                                {
+                                    if (delResult.removeBindResultResponseData == null)
+                                    {
+                                        if (delResult.delDeviceBindResponseData != null)
+                                        {
+                                            foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList)
+                                            {
+                                                if (d.Result != 1)
+                                                {
+                                                    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;
+                                                }
+                                            }
+                                        }
+                                    }
                                 }
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
@@ -1115,8 +1139,9 @@
                             {
                                 var delDevice = DelBindDevice(curBindDevice);
                                 var delResult = new DelDeviceBindResponseAllData();
-                                delResult = await curControlDev.DelDeviceBindAsync(delDevice);
-                                if (delResult == null || delResult.removeBindResultResponseData == null)
+                                delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
+
+                                if (delResult == null)
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
@@ -1126,6 +1151,29 @@
                                         CommonPage.Loading.Hide();
                                     });
                                     return;
+                                }
+                                else
+                                {
+                                    if (delResult.removeBindResultResponseData == null)
+                                    {
+                                        if (delResult.delDeviceBindResponseData != null)
+                                        {
+                                            foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList)
+                                            {
+                                                if (d.Result != 1)
+                                                {
+                                                    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;
+                                                }
+                                            }
+                                        }
+                                    }
                                 }
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
@@ -1171,7 +1219,7 @@
                             addBindInfo.BindType = 0;
                             addBindInfo.BindMacAddr = de.DeviceAddr;
                             addBindInfo.BindEpoint = de.DeviceEpoint;
-                            addBindeDev.BindName = de.DeviceEpointName;
+                            addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de);
                             switch (curDeviceBindType)
                             {
                                 case 2:
@@ -1191,7 +1239,7 @@
                         }
 
                         var dev = new AddedDeviceBindResponseAllData();
-                        dev = await curControlDev.AddDeviceBindAsync(addBindeDev);
+                        dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev);
                         if (dev == null || dev.addedDeviceBindResponseData == null)
                         {
                             Application.RunOnMainThread(() =>

--
Gitblit v1.8.0