From 23532fa8ad34c89b6d24b01eaef6475fd0aad898 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 15 四月 2020 18:08:24 +0800
Subject: [PATCH] ???????

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |  107 ++++++++++++++++++++++++-----------------------------
 1 files changed, 48 insertions(+), 59 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index 06e29ea..72394ac 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using Microsoft.AppCenter.Crashes;
 using Shared.Common;
-using Shared.Phone.Device.Light;
 using Shared.Phone.UserCenter.Device;
 using ZigBee.Device;
 using static ZigBee.Device.BindObj;
@@ -10,19 +9,8 @@
 
 namespace Shared.Phone.UserCenter.DeviceBind
 {
-    public class AddScenePage : BindCommonLayout, ZigBee.Common.IStatus
+    public class AddScenePage : BindCommonLayout
     {
-        /// <summary>
-        /// 鎸夐敭妯″紡鎺ユ敹
-        /// </summary>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-            Shared.Application.RunOnMainThread(() =>
-            {
-            });
-        }
-
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
@@ -112,8 +100,8 @@
 
             var btnBindDown = new Button
             {
-                Height = Application.GetRealHeight(69),
-                Width = Application.GetRealWidth(69),
+                Height = Application.GetMinReal(69),
+                Width = Application.GetMinReal(69),
                 X = Application.GetRealWidth(200 - 77),
                 UnSelectedImagePath = "BindPic/BindDown.png",
                 Gravity = Gravity.CenterVertical,
@@ -183,14 +171,15 @@
 
             #region 鏁版嵁澶勭悊  
             //鑾峰彇妤煎眰
-            dicFloor = Common.Room.CurrentRoom.GetFloorSortList();
+            dicFloor = HdlRoomLogic.Current.GetFloorSortList();
             currentKey.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId();
-            btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
-
+            btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
+
+            var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
             if (Common.Config.Instance.Home.FloorDics.Count == 0)
             {
                 // 鑾峰彇娌℃湁妤煎眰鎴块棿
-                foreach (var room in Shared.Common.Room.Lists)
+                foreach (var room in listAllRoom)
                 {
                     if (string.IsNullOrEmpty(room.FloorId))
                     {
@@ -201,7 +190,7 @@
             else
             {
                 // 鑾峰彇妤煎眰瀵瑰簲瀵规埧闂�
-                foreach (var room in Shared.Common.Room.Lists)
+                foreach (var room in listAllRoom)
                 {
                     if (room.FloorId == currentKey.currentSelectFloorId)
                     {
@@ -235,7 +224,7 @@
             int index = 0;
             RefreshRoomList(curRoom, ref index);
 
-            if (curRoom.SceneUIList.Count == 0)
+            if (curRoom.ListSceneId.Count == 0)
             {
                 btnFinifh.Enable = false;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -479,7 +468,7 @@
                 }
 
                 //濡傛灉鎴块棿涓病鏈夊満鏅紝鍒欎笉鏄剧ず
-                if (room.SceneUIList.Count == 0)
+                if (room.ListSceneId.Count == 0)
                 {
                     continue;
                 }
@@ -494,8 +483,8 @@
 
                 var btnRoomFrameLayout = new FrameLayout
                 {
-                    Height = Application.GetRealHeight(159),
-                    Width = Application.GetRealWidth(255),
+                    Height = Application.GetMinReal(159),
+                    Width = Application.GetMinReal(255),
                     Y = Application.GetRealHeight(23),
                     X = Application.GetRealWidth(5),
                     BackgroundImagePath = "Item/RoomIconBackground.png",
@@ -549,7 +538,7 @@
                     }
                     curRoom = room;
                     currentKey.RoomId = room.Id;
-                    if (curRoom.SceneUIList.Count == 0)
+                    if (curRoom.ListSceneId.Count == 0)
                     {
                         btnFinifh.Enable = false;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
@@ -587,7 +576,7 @@
         void RefreshSceneList(Shared.Common.Room curRoom)
         {
             midVerticalScrolViewLayout.RemoveAll();
-            if (curRoom.SceneUIList.Count == 0)
+            if (curRoom.ListSceneId.Count == 0)
             {
                 return;
             }
@@ -614,8 +603,8 @@
                 {
                     X = Application.GetMinRealAverage(58),
                     Y = Application.GetMinRealAverage(46),
-                    Width = Application.GetMinRealAverage(81),
-                    Height = Application.GetMinRealAverage(81),
+                    Width = Application.GetMinReal(81),
+                    Height = Application.GetMinReal(81),
                     UnSelectedImagePath = "Scene/SceneIcon.png",// scene.IconPath,
                 };
                 rowLayout.AddChidren(devicePic);
@@ -632,8 +621,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinReal(60),
+                    Height = Application.GetMinReal(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -651,7 +640,7 @@
                 };
                 rowLayout.AddChidren(line2);
 
-                if (curIndex == curRoom.SceneUIList.Count - 1)
+                if (curIndex == curRoom.ListSceneId.Count - 1)
                 {
                     line2.Visible = false;
                 }
@@ -772,8 +761,8 @@
 
             var sidelipFrameLayout = new FrameLayout()
             {
-                Height = Application.GetRealHeight(783),
-                Width = Application.GetRealWidth(449),
+                Height = Application.GetMinReal(783),
+                Width = Application.GetMinReal(449),
                 Y = Application.GetRealHeight(161),
                 X = Application.GetRealWidth(596),
                 BackgroundImagePath = "DoorLock/SideslipPic.png",
@@ -815,8 +804,8 @@
 
                 var btnAllMethod = new Button()
                 {
-                    Width = Application.GetRealWidth(81),
-                    Height = Application.GetRealHeight(81),
+                    Width = Application.GetMinReal(81),
+                    Height = Application.GetMinReal(81),
                     Y = Application.GetRealHeight(55),
                     UnSelectedImagePath = "Floor/Floor.png",
                     SelectedImagePath = "Floor/FloorSelected.png",
@@ -868,10 +857,11 @@
                         btnMethodText.IsSelected = true;
                         oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                         oldbuttonText.IsBold = true;
-                    }
-
-                    //鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂�
-                    foreach (var room in Shared.Common.Room.Lists)
+                    }
+
+                    //鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂�
+                    var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
+                    foreach (var room in listAllRoom)
                     {
                         if (room.FloorId == currentKey.currentSelectFloorId)
                         {
@@ -916,9 +906,10 @@
         /// <returns></returns>
         List<SceneUI> GetALlDispalyRoomSceneList()
         {
-            currentKeyAllRoomSceneList.Clear();
-            // 鑾峰彇鎵�鏈夋埧闂� 
-            foreach (var room in Shared.Common.Room.Lists)
+            currentKeyAllRoomSceneList.Clear();
+            // 鑾峰彇鎵�鏈夋埧闂� 
+            var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
+            foreach (var room in listAllRoom)
             {
                 //濡傛灉鎴块棿涓哄枩鐖憋紝鍒欎笉鏄剧ず
                 if (room.IsLove == true)
@@ -926,13 +917,18 @@
                     continue;
                 }
                 //濡傛灉鎴块棿涓病鏈夊満鏅紝鍒欎笉鏄剧ず
-                if (room.SceneUIList.Count == 0)
+                if (room.ListSceneId.Count == 0)
                 {
                     continue;
                 }
 
-                foreach (var scene in room.SceneUIList)
-                {
+                foreach (var sceneId in room.ListSceneId)
+                {
+                    var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId);
+                    if (scene == null)
+                    {
+                        continue;
+                    }
                     currentKeyAllRoomSceneList.Add(scene);
                 }
             }
@@ -946,27 +942,20 @@
         List<SceneUI> GetMatchSceneUIList(Shared.Common.Room curRoom)
         {
             var tempSceneUIList = new List<SceneUI>();
-            foreach (var scene in curRoom.SceneUIList)
+            foreach (var sceneId in curRoom.ListSceneId)
             {
-                var gwSc = gwCurScenesList.Find(obj => (obj.ScenesId == scene.Id));
+                var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId);
+                if (scene == null)
+                {
+                    continue;
+                }
+                var gwSc = gwCurScenesList.Find(obj => (obj.ScenesId == sceneId));
                 if (gwSc != null)
                 {
                     tempSceneUIList.Add(scene);
                 }
             }
             return tempSceneUIList;
-        }
-
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-        }
-
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-
-        public void ChangedISceneStatus(Scene scene)
-        {
         }
     }
 }

--
Gitblit v1.8.0