From 98ceb6bd2021f9ff136cda27eef28676dd7b5d92 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 21 五月 2020 13:24:02 +0800
Subject: [PATCH] 最后的版本

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index e5976fd..647af1d 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -14,10 +14,9 @@
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
-        public AddScenePage(ZigBee.Device.Panel key, List<ScenesListInfo> gwScenesList)
+        public AddScenePage(ZigBee.Device.Panel key)
         {
             this.currentKey = key;
-            gwCurScenesList = gwScenesList;
         }
 
         #region  鍙橀噺鐢虫槑
@@ -62,10 +61,7 @@
         /// </summary>
         Dictionary<string, string> dicFloor;
         List<SceneUI> currentKeyAllRoomSceneList = new List<SceneUI>();
-        /// <summary>
-        /// 缃戝叧涓殑鍦烘櫙鍒楄〃
-        /// </summary>
-        public List<ScenesListInfo> gwCurScenesList = new List<ScenesListInfo>();
+
         #endregion
 
         /// <summary>
@@ -279,7 +275,7 @@
                     Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
                     if (currentKey.bindList.Count != 0)
                     {
-                        var bindResult = await currentKey.ClearBindInfoAsync();
+                        var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey);
                         if (bindResult != null && bindResult.clearBindInfoResponseData != null)
                         {
                             if (bindResult.clearBindInfoResponseData.Result != 0)
@@ -315,7 +311,7 @@
                         }
                     }
 
-                    var temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Scene_Trigger);
+                    var temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Scene_Trigger);
                     if (temp == null || temp.setWritableValueResponData == null)
                     {
                         Application.RunOnMainThread(() =>
@@ -374,7 +370,7 @@
                         }
 
                         var dev = new AddedDeviceBindResponseAllData();
-                        dev = await currentKey.AddDeviceBindAsync(addBindeDev);
+                        dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev);
                         if (dev != null && dev.addedDeviceBindResponseData != null)
                         {
                             if (dev.addedDeviceBindResponseData.Result == 0)
@@ -490,11 +486,11 @@
                 {
                     roomTempList.Add(room);
                 }
-                if (roomTempList.Count != 0)
-                {
-                    curRoom = roomTempList[0];
-                }
-
+            }
+            for (int i = 0; i < roomTempList.Count; i++)
+            {
+                var room = roomTempList[i];
+                curRoom = roomTempList[0];
                 var btnRoomFrameLayout = new FrameLayout
                 {
                     Height = Application.GetMinReal(159),
@@ -527,6 +523,20 @@
                     curentOldRoom = btnRoom;
                     curentOldRoomFrameLayout = btnRoomFrameLayout;
                 }
+
+                if (index == roomTempList.Count - 1 && index > 3)
+                {
+                    var btnRoomFrameLayoutEmpty = new FrameLayout
+                    {
+                        Height = Application.GetMinReal(159),
+                        Width = Application.GetMinReal(50),
+                        Y = Application.GetRealHeight(23),
+                        X = Application.GetRealWidth(5),
+                        BorderWidth = 1,
+                    };
+                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
+                }
+
                 EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
                 {
                     if (!btnRoom.IsSelected)
@@ -975,11 +985,7 @@
                 {
                     continue;
                 }
-                var gwSc = gwCurScenesList.Find(obj => (obj.ScenesId == sceneId));
-                if (gwSc != null)
-                {
-                    tempSceneUIList.Add(scene);
-                }
+                tempSceneUIList.Add(scene);
             }
             return tempSceneUIList;
         }

--
Gitblit v1.8.0