From 2e7e5f9af5b32cfe1fc3c6ba40bf7eb984bbd0a4 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 11 五月 2020 17:52:06 +0800
Subject: [PATCH] ???????

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |   58 ++++++++++++++++++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index 3cf0c4f..e5976fd 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -36,7 +36,11 @@
         /// <summary>
         /// 鎸夐敭閰嶇疆鐨勭洰鏍囧垪琛�
         /// </summary>
-        List<CommonDevice> targetList = new List<CommonDevice>();
+        List<CommonDevice> targetListDevice = new List<CommonDevice>();
+        /// <summary>
+        /// 鎸夐敭閰嶇疆鐨勫満鏅洰鏍囧垪琛�
+        /// </summary>
+        List<SceneUI> targetListScene = new List<SceneUI>();
         /// <summary>
         /// 鏈湴鎴块棿鍒楄〃
         /// </summary>
@@ -224,7 +228,7 @@
                         var sc = currentKey.bindList.Find(obj => (obj != null) && (obj.BindScenesId == scTemp.Id));
                         if (sc != null)
                         {
-                            targetList.Add(scTemp);
+                            targetListScene.Add(scTemp);
                         }
                     }
                 }
@@ -244,7 +248,7 @@
                 btnFinifh.Enable = true;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
             }
-            if (targetList.Count == 0)
+            if (targetListDevice.Count == 0 && targetListScene.Count == 0)
             {
                 btnFinifh.Enable = false;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -259,7 +263,7 @@
                 bool isFinish = false;
                 try
                 {
-                    if (targetList.Count == 0)
+                    if (targetListDevice.Count == 0 && targetListScene.Count == 0)
                     {
                         Application.RunOnMainThread(() =>
                         {
@@ -348,7 +352,7 @@
                         var addBindeDev = new AddBindData();
                         addBindeDev.DeviceAddr = currentKey.DeviceAddr;
                         addBindeDev.Epoint = currentKey.DeviceEpoint;
-                        foreach (var de in targetList)
+                        foreach (var de in targetListDevice)
                         {
                             if (de.DeviceAddr != null)
                             {
@@ -359,15 +363,14 @@
                                 addBindInfo.BindEpoint = de.DeviceEpoint;
                                 addBindeDev.BindList.Add(addBindInfo);
                             }
-                            else
-                            {
-                                var addBindInfo = new AddBindListObj();
-                                addBindInfo.BindType = 1;
-                                addBindInfo.BindCluster = 6;
-                                var sc1 = (SceneUI)de;
-                                addBindInfo.BindScenesId = sc1.Id;
-                                addBindeDev.BindList.Add(addBindInfo);
-                            }
+                        }
+                        foreach (var de in targetListScene)
+                        {
+                            var addBindInfo = new AddBindListObj();
+                            addBindInfo.BindType = 1;
+                            addBindInfo.BindCluster = 6;
+                            addBindInfo.BindScenesId = de.Id;
+                            addBindeDev.BindList.Add(addBindInfo);
                         }
 
                         var dev = new AddedDeviceBindResponseAllData();
@@ -377,7 +380,8 @@
                             if (dev.addedDeviceBindResponseData.Result == 0)
                             {
                                 currentKey.bindList = dev.addedDeviceBindResponseData.BindList;
-                                targetList.Clear();
+                                targetListDevice.Clear();
+                                targetListScene.Clear();
                                 isFinish = true;
                                 if (isFinish)
                                 {
@@ -547,7 +551,6 @@
                         curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
                     }
                     curRoom = room;
-                    currentKey.RoomId = room.Id;
                     if (curRoom.ListSceneId.Count == 0)
                     {
                         btnFinifh.Enable = false;
@@ -558,7 +561,7 @@
                         btnFinifh.Enable = true;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                     }
-                    if (targetList.Count == 0)
+                    if (targetListDevice.Count == 0 && targetListScene.Count == 0)
                     {
                         btnFinifh.Enable = false;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -665,7 +668,7 @@
                 {
                     btnBindName.Text = scene.Name;
                 }
-                if (targetList.Count == 0)
+                if (targetListDevice.Count == 0 && targetListScene.Count == 0)
                 {
                     foreach (var bindedSc in currentKey.bindList)
                     {
@@ -674,16 +677,15 @@
                             btnChoose.IsSelected = true;
                             btnChoose.Visible = true;
                             oldScene = btnChoose;
-                            targetList.Add(scene);
+                            targetListScene.Add(scene);
                         }
                     }
                 }
                 else
                 {
-                    foreach (var bindedSc in targetList)
+                    foreach (var bindedSc in targetListScene)
                     {
-                        var sc1 = (SceneUI)bindedSc;
-                        if (scene.Id == sc1.Id)
+                        if (scene.Id == bindedSc.Id)
                         {
                             btnChoose.IsSelected = true;
                             btnChoose.Visible = true;
@@ -719,11 +721,11 @@
                         oldScene = btnChoose;
                         oldScene.IsSelected = true;
                         oldScene.Visible = true;
-                        currentKey.curSelectSceneID = scene.Id.ToString();
-                        targetList.Clear();
-                        targetList.Add(scene);
+                        targetListDevice.Clear();
+                        targetListScene.Clear();
+                        targetListScene.Add(scene);
                     }
-                    if (targetList.Count == 0)
+                    if (targetListDevice.Count == 0 && targetListScene.Count == 0)
                     {
                         btnFinifh.Enable = false;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -740,7 +742,7 @@
                 btnChoose.MouseUpEventHandler += hander;
                 curIndex++;
             }
-            if (targetList.Count == 0)
+            if (targetListDevice.Count == 0 && targetListScene.Count == 0)
             {
                 btnFinifh.Enable = false;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -893,7 +895,7 @@
                     int index = 0;
                     RefreshRoomList(curRoom, ref index);
                     RefreshSceneList(roomList[0]);
-                    if (targetList.Count == 0)
+                    if (targetListDevice.Count == 0 && targetListScene.Count == 0)
                     {
                         btnFinifh.Enable = false;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;

--
Gitblit v1.8.0