From 2d5639dfb8014e78e6f1e68240fa751c19bb3a28 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 02 一月 2020 18:35:40 +0800
Subject: [PATCH] 2019.1.2

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |   49 ++++++++++++++++++++++---------------------------
 1 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index e019f26..6660e7d 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -119,10 +119,6 @@
         /// sceneList
         /// </summary>
         private List<SceneUI> sceneList;
-        /// <summary>
-        /// 褰撳墠閫変腑鎴块棿
-        /// </summary>
-        private Common.Room curRoom;
         #endregion
 
         #region 鈼� 鎺ュ彛____________________________
@@ -728,6 +724,7 @@
             floors.FloorAction += (floorId) =>
             {
                 floorBtn.Text = Config.Instance.Home.GetFloorNameById(floorId);
+                Common.Room.CurrentRoom = Common.Room.CurrentRoom.GetLoveRoom();
                 RefreshBodyView();
             };
         }
@@ -1066,7 +1063,7 @@
                                 {
                                     if (e2)
                                     {
-                                        if(curRoom.IsLove)
+                                        if(Common.Room.CurrentRoom.IsLove)
                                         {
                                             Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
                                             deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
@@ -1177,7 +1174,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, curRoom);
+                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
                                         }
                                         else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
                                         {
@@ -1185,7 +1182,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, curRoom);
+                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
                                         }
                                         else
                                         {
@@ -1193,7 +1190,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, curRoom);
+                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
                                         }
                                     };
 
@@ -1207,7 +1204,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1297,7 +1294,7 @@
                                         UserView.HomePage.Instance.AddChidren(lightControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         //lightControl.action = RefreshBodyView;
-                                        lightControl.Show(deviceUI, curRoom);
+                                        lightControl.Show(deviceUI, Common.Room.CurrentRoom);
                                     };
 
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1310,7 +1307,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1400,7 +1397,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //dimmableLightControl.action = RefreshBodyView;
-                                        dimmableLightControl.Show(deviceUI, curRoom);
+                                        dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom);
                                     };
 
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1413,7 +1410,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1509,7 +1506,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1524,7 +1521,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //rollerShadeControl.action = RefreshBodyView;
-                                        acControl.Show(deviceUI, curRoom);
+                                        acControl.Show(deviceUI, Common.Room.CurrentRoom);
                                     };
                                 }
                             }
@@ -1592,14 +1589,12 @@
                                     var editBtn = new CommonForm.RowLayoutEditButton()
                                     {
                                         Tag = deviceUI,
-                                        Radius = 0
                                     };
                                     var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                     {
                                         Tag = deviceUI,
-                                        Radius = 0
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1614,7 +1609,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //rollerShadeControl.action = RefreshBodyView;
-                                        rollerShadeControl.Show(deviceUI, curRoom);
+                                        rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom);
                                     };
                                 }
                             }
@@ -1638,7 +1633,7 @@
 
                                 deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                 {
-                                    var userDoorLockPage = new UserDoorLockPage(curRoom, deviceUI);
+                                    var userDoorLockPage = new UserDoorLockPage(Common.Room.CurrentRoom, deviceUI);
                                     HomePage.Instance.AddChidren(userDoorLockPage);
                                     HomePage.Instance.PageIndex += 1;
                                     userDoorLockPage.Show();
@@ -1652,7 +1647,7 @@
                                 {
                                     Tag = deviceUI
                                 };
-                                if (curRoom.IsSharedRoom == false)
+                                if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                 {
                                     deviceTypeRowLayout.AddRightView(editBtn);
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1686,7 +1681,7 @@
                                 {
                                     Tag = deviceUI
                                 };
-                                if (curRoom.IsSharedRoom == false)
+                                if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                 {
                                     deviceTypeRowLayout.AddRightView(editBtn);
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1756,7 +1751,7 @@
                                     {
                                         Tag = deviceUI
                                     };
-                                    if (curRoom.IsSharedRoom == false)
+                                    if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1792,7 +1787,7 @@
                                 {
                                     Tag = deviceUI
                                 };
-                                if (curRoom.IsSharedRoom == false)
+                                if (Common.Room.CurrentRoom.IsSharedRoom == false)
                                 {
                                     deviceTypeRowLayout.AddRightView(editBtn);
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1850,10 +1845,9 @@
                 roomBtn.SetTitle(room.Name);
                 row.AddChidren(roomBtn);
 
-                if (room.IsLove)
+                if (room.Id == Common.Room.CurrentRoom.Id)
                 {
                     roomBtn.IsSelected = true;
-                    this.curRoom = room;
                     curBtn = roomBtn;
                     if(sceneBtn.IsSelected)
                     {
@@ -1864,6 +1858,7 @@
                         RefreshFunction(room);
                     }
                 }
+
                 roomBtn.ButtonClickEvent += (sender, e) =>
                 {
                     if (sender  == curBtn)
@@ -1873,7 +1868,7 @@
                     sender.IsSelected = true;
                     curBtn.IsSelected = false;
                     curBtn = sender;
-                    this.curRoom = room;
+                    Common.Room.CurrentRoom = room;
                     if (sceneBtn.IsSelected)
                     {
                         RefreshScene(room);

--
Gitblit v1.8.0