From 0e0584b87851c56745bf73b1a961b80613dd0721 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 19 五月 2020 16:35:16 +0800
Subject: [PATCH] 2020-05-19-4

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs |   54 ++++++++++++++++++++++++++----------------------------
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
index 14d3e84..b6b4a78 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
@@ -67,10 +67,6 @@
         /// </summary>
         List<int> typeModeList;
         /// <summary>
-        /// 缃戝叧涓殑鍦烘櫙鍒楄〃
-        /// </summary>
-        public List<ScenesListInfo> gwScenesList = new List<ScenesListInfo>();
-        /// <summary>
         /// 鏄惁鏀寔璇诲彇
         /// </summary>
         bool IsRead = false;
@@ -95,21 +91,12 @@
                     }
                     //鑾峰彇鏈湴鍦烘櫙鍒楄〃
                     scList = HdlSceneLogic.Current.GetAllRoomSceneList();
-                    //鑾峰彇缃戝叧鍦烘櫙琛�
-                    if (gwScenesList.Count == 0)
-                    {
-                        var gwSceneObj = await currentKey.GetSceneInfoAsync();
-                        if (gwSceneObj != null && gwSceneObj.getSceneInfo != null)
-                        {
-                            gwScenesList = gwSceneObj.getSceneInfo.ScenesList;
-                        }
-                    }
 
                     //鍔ㄦ�佽幏鍙栨寜閿敮鎸佺殑澶х被
                     typeModeList = await GetTypeMode();
                     #region 璇诲彇闈㈡澘褰撳墠妯″紡
                     //璇诲彇鎸夐敭褰撳墠妯″紡
-                    var tempDeata = await currentKey.ReadPanelConfigureInfoAsync();
+                    var tempDeata = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(currentKey);
                     if (tempDeata != null && tempDeata.deviceStatusReportData != null)
                     {
                         foreach (var attr in tempDeata.deviceStatusReportData.AttriBute)
@@ -136,7 +123,7 @@
                             GetDeviceBindResponseAllData getBindList = null;
                             if (IsRead)
                             {
-                                getBindList = await currentKey.GetDeviceBindAsync();
+                                getBindList = HdlDeviceBindLogic.Current.GetDeviceBindAsync(currentKey);
                                 var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
                                 var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
                                 if (getBindList != null && getBindList.getAllBindResponseData != null)
@@ -270,7 +257,7 @@
                     {
                         currentClusterID = 6;
                         currentKey.panelMode = 1;
-                        var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey, gwScenesList);
+                        var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey);
                         Shared.Phone.UserView.HomePage.Instance.AddChidren(addScenePage);
                         Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                         addScenePage.Show();
@@ -647,7 +634,7 @@
                      try
                      {
                          CommonPage.Loading.Start("");
-                         var bindResult = await currentKey.ClearBindInfoAsync();
+                         var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey);
                          if (bindResult != null && bindResult.clearBindInfoResponseData != null)
                          {
                              if (bindResult.clearBindInfoResponseData.Result != 0)
@@ -658,10 +645,10 @@
                              }
                              else
                              {
-                                 var temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Default);
+                                 var temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Default);
                                  if (temp != null && temp.setWritableValueResponData?.Status != 0)
                                  {
-                                     var temp1 = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Default);
+                                     var temp1 = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Default);
                                      if (temp1 != null && temp1.setWritableValueResponData?.Status != 0)
                                      {
                                          new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ChangeBindMode), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
@@ -691,7 +678,6 @@
                              currentKey.bindList.Clear();
                              RefreshList();
                              //濡傛灉鏄満鏅紝鐢ㄦ埛鍒犻櫎娓呯┖褰撳墠鍒版埧闂村垪琛�
-                             currentKey.RoomId = "";
                              currentKey.ReSave();
                          }
                          CommonPage.Loading.Hide();
@@ -740,21 +726,27 @@
             if (typeModeList == null)
             {
                 //鍐嶆鍔ㄦ�佽幏鍙栨寜閿敮鎸佺殑澶х被
-                CommonPage.Loading.Start();
+                Application.RunOnMainThread(() =>
+                {
+                    CommonPage.Loading.Start();
+                });
                 typeModeList = await GetTypeMode();
                 if (typeModeList == null)
                 {
                     Application.RunOnMainThread(() =>
                     {
                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        CommonPage.Loading.Hide();
                     });
-                    CommonPage.Loading.Hide();
                     dialog.Close();
                     return;
                 }
                 else
                 {
-                    CommonPage.Loading.Hide();
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonPage.Loading.Hide();
+                    });
                 }
             }
 
@@ -897,7 +889,7 @@
                                      var result = await RemoveTargets(bindSc, line2);
                                      if (result == 0)
                                      {
-                                         var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey, gwScenesList);
+                                         var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey);
                                          Shared.Phone.UserView.HomePage.Instance.AddChidren(addScenePage);
                                          Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                          addScenePage.Show();
@@ -920,7 +912,7 @@
                         }
                         else
                         {
-                            var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey, gwScenesList);
+                            var addScenePage = new Shared.Phone.UserCenter.DeviceBind.AddScenePage(currentKey);
                             Shared.Phone.UserView.HomePage.Instance.AddChidren(addScenePage);
                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                             addScenePage.Show();
@@ -1124,6 +1116,13 @@
         /// <returns></returns>
         private async System.Threading.Tasks.Task<List<int>> GetTypeMode()
         {
+            //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                //鍒欓粯璁ゅ叏閮ㄥ姛鑳介兘缁欏畠
+                typeModeList = new List<int>() { 1, 100, 200, 300, 0, 101, 102 };
+                return typeModeList;
+            }
             if (typeModeList != null)
             {
                 typeModeList.Clear();
@@ -1179,7 +1178,7 @@
             {
                 CommonPage.Loading.Start("");
                 var delResult = new DelDeviceBindResponseAllData();
-                delResult = await currentKey.DelDeviceBindAsync(delDevice);
+                delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
                 if (delResult != null && delResult.delDeviceBindResponseData != null)
                 {
                     if (delResult.delDeviceBindResponseData?.RemoveBindList != null)
@@ -1196,7 +1195,6 @@
                                     {
                                         currentKey.panelMode = 65535;
                                     }
-                                    currentKey.RoomId = "";
                                     currentKey.ReSave();
                                     return 0;
                                     break;
@@ -1206,7 +1204,7 @@
                                     {
                                         CommonPage.Loading.Start("");
 
-                                        var getBindList = await currentKey.GetDeviceBindAsync();
+                                        var getBindList = HdlDeviceBindLogic.Current.GetDeviceBindAsync(currentKey);
                                         var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
                                         var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
                                         if (getBindList != null)

--
Gitblit v1.8.0