From 2450c12c825ad4d78d1572da2fa421706db2df2f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 18 六月 2020 16:01:14 +0800
Subject: [PATCH] 新代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs |  238 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 173 insertions(+), 65 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
index 1540752..b996092 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
@@ -38,7 +38,7 @@
         /// <summary>
         /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew
         /// </summary>
-        VerticalFrameRefreshControl midVerticalScrolViewLayout;
+        VerticalRefreshLayout midVerticalScrolViewLayout;
         /// <summary>
         /// 鏄剧ず鎴块棿鐨剉iew
         /// </summary>
@@ -221,7 +221,7 @@
             btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout);
 
             //璁惧鏍�
-            midVerticalScrolViewLayout = new VerticalFrameRefreshControl()
+            midVerticalScrolViewLayout = new VerticalRefreshLayout()
             {
                 Y = btnMidTopLayout.Bottom,
                 Height = Application.GetRealHeight(1145),
@@ -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,69 +953,129 @@
                                 delDevice.RemoveBindList.Add(removeDevice);
 
                                 var delResult = new DelDeviceBindResponseAllData();
-                                delResult = await curControlDev.DelDeviceBindAsync(delDevice);
-                                if (delResult != null && delResult.removeBindResultResponseData != null)
-                                {
-                                    if (delResult.removeBindResultResponseData.Result == 0)
-                                    {
-                                        switch (curDeviceBindType)
-                                        {
-                                            case 1:
-                                                if (actionFreshAirTarget != null)
-                                                {
-                                                    actionFreshAirTarget("");
-                                                }
-                                                break;
-                                            case 2:
-                                                if (actionTemperatureTarget != null)
-                                                {
-                                                    actionTemperatureTarget("");
-                                                }
-                                                break;
-                                            case 3:
-                                                if (actionHumidityTarget != null)
-                                                {
-                                                    actionHumidityTarget("");
-                                                }
-                                                break;
-                                            case 4:
-                                                if (actionPMTarget != null)
-                                                {
-                                                    actionPMTarget("");
-                                                }
-                                                break;
-                                        }
-                                        Application.RunOnMainThread(() =>
-                                        {
-                                            CommonPage.Loading.Hide();
-                                            btnFinifh.Enable = true;
-                                            btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                                            this.RemoveFromParent();
-                                        });
-
-                                    }
-                                    else
-                                    {
-                                        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;
-                                    }
-                                }
-                                else
+                                delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
+                                if (delResult == null)
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
-                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OperrateFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+                                        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;
+                                }
+                                else
+                                {
+                                    if (delResult.removeBindResultResponseData == null)
+                                    {
+                                        if (delResult.delDeviceBindResponseData != null)
+                                        {
+                                            foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList)
+                                            {
+                                                if (d.Result == 1)
+                                                {
+                                                    switch (curDeviceBindType)
+                                                    {
+                                                        case 1:
+                                                            if (actionFreshAirTarget != null)
+                                                            {
+                                                                actionFreshAirTarget("");
+                                                            }
+                                                            break;
+                                                        case 2:
+                                                            if (actionTemperatureTarget != null)
+                                                            {
+                                                                actionTemperatureTarget("");
+                                                            }
+                                                            break;
+                                                        case 3:
+                                                            if (actionHumidityTarget != null)
+                                                            {
+                                                                actionHumidityTarget("");
+                                                            }
+                                                            break;
+                                                        case 4:
+                                                            if (actionPMTarget != null)
+                                                            {
+                                                                actionPMTarget("");
+                                                            }
+                                                            break;
+                                                    }
+                                                    Application.RunOnMainThread(() =>
+                                                    {
+                                                        CommonPage.Loading.Hide();
+                                                        btnFinifh.Enable = true;
+                                                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                                        this.RemoveFromParent();
+                                                    });
+                                                }
+                                                else
+                                                {
+                                                    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;
+                                                }
+                                            }
+                                        }
+                                    }
+                                    else
+                                    {
+                                        if (delResult.removeBindResultResponseData.Result == 0)
+                                        {
+                                            switch (curDeviceBindType)
+                                            {
+                                                case 1:
+                                                    if (actionFreshAirTarget != null)
+                                                    {
+                                                        actionFreshAirTarget("");
+                                                    }
+                                                    break;
+                                                case 2:
+                                                    if (actionTemperatureTarget != null)
+                                                    {
+                                                        actionTemperatureTarget("");
+                                                    }
+                                                    break;
+                                                case 3:
+                                                    if (actionHumidityTarget != null)
+                                                    {
+                                                        actionHumidityTarget("");
+                                                    }
+                                                    break;
+                                                case 4:
+                                                    if (actionPMTarget != null)
+                                                    {
+                                                        actionPMTarget("");
+                                                    }
+                                                    break;
+                                            }
+                                            Application.RunOnMainThread(() =>
+                                            {
+                                                CommonPage.Loading.Hide();
+                                                btnFinifh.Enable = true;
+                                                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                                this.RemoveFromParent();
+                                            });
+
+                                        }
+                                        else
+                                        {
+                                            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;
+                                        }
+                                    }
                                 }
                             }
                         }
@@ -1079,8 +1139,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 +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)
                                 {
@@ -1115,8 +1199,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 +1211,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 +1279,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 +1299,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