From 628944302744c7b98fb0401125c49cc72f2a7ee3 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 20 十二月 2019 15:32:10 +0800
Subject: [PATCH] 2019.12.20

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

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 75b3e76..12a2521 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -122,7 +122,7 @@
         /// <summary>
         /// 褰撳墠閫変腑鎴块棿
         /// </summary>
-        private Common.Room room;
+        private Common.Room curRoom;
         #endregion
 
         #region 鈼� 鎺ュ彛____________________________
@@ -799,18 +799,25 @@
         {
             devList = room.DeviceUIList;
             sceneList = room.SceneUIList;
-            var sameDevList = new List<DeviceUI> { };
             typeDeviceDic.Clear();
             typeIdDic.Clear();
             foreach (var device in devList)
             {
                 var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice });
-                if(info.BeloneType== DeviceBeloneType.A骞叉帴鐐� || info.BeloneType==DeviceBeloneType.A涓户鍣�)
+                if (info.BeloneType == DeviceBeloneType.A骞叉帴鐐� || info.BeloneType == DeviceBeloneType.A涓户鍣�)
                 {
                     continue;
                 }
-                sameDevList.Add(device);
-                typeDeviceDic[info.BeloneTextId] = sameDevList;
+                if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false)
+                {
+                    var sameDevList = new List<DeviceUI> { };
+                    sameDevList.Add(device);
+                    typeDeviceDic[info.BeloneTextId] = sameDevList;
+                }
+                else
+                {
+                    typeDeviceDic[info.BeloneTextId].Add(device);
+                }
                 typeIdDic[info.BeloneTextId] = info.ConcreteType;
             }
         }
@@ -1081,7 +1088,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, room);
+                                            lightControl.Show(deviceUI, curRoom);
                                         }
                                         else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
                                         {
@@ -1089,7 +1096,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, room);
+                                            lightControl.Show(deviceUI, curRoom);
                                         }
                                         else
                                         {
@@ -1097,7 +1104,7 @@
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, room);
+                                            lightControl.Show(deviceUI, curRoom);
                                         }
                                     };
 
@@ -1111,7 +1118,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (room.IsSharedRoom == false)
+                                    if (curRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1201,7 +1208,7 @@
                                         UserView.HomePage.Instance.AddChidren(lightControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         //lightControl.action = RefreshBodyView;
-                                        lightControl.Show(deviceUI, room);
+                                        lightControl.Show(deviceUI, curRoom);
                                     };
 
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1214,7 +1221,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (room.IsSharedRoom == false)
+                                    if (curRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1304,7 +1311,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //dimmableLightControl.action = RefreshBodyView;
-                                        dimmableLightControl.Show(deviceUI, room);
+                                        dimmableLightControl.Show(deviceUI, curRoom);
                                     };
 
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1317,7 +1324,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (room.IsSharedRoom == false)
+                                    if (curRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1412,7 +1419,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (room.IsSharedRoom == false)
+                                    if (curRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1427,7 +1434,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //rollerShadeControl.action = RefreshBodyView;
-                                        acControl.Show(deviceUI, room);
+                                        acControl.Show(deviceUI, curRoom);
                                     };
                                 }
                             }
@@ -1502,7 +1509,7 @@
                                         Tag = deviceUI,
                                         Radius = 0
                                     };
-                                    if (room.IsSharedRoom == false)
+                                    if (curRoom.IsSharedRoom == false)
                                     {
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1517,7 +1524,7 @@
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
                                         //rollerShadeControl.action = RefreshBodyView;
-                                        rollerShadeControl.Show(deviceUI, room);
+                                        rollerShadeControl.Show(deviceUI, curRoom);
                                     };
                                 }
                             }
@@ -1541,7 +1548,7 @@
 
                                 deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                 {
-                                    var userDoorLockPage = new UserDoorLockPage(room, deviceUI);
+                                    var userDoorLockPage = new UserDoorLockPage(curRoom, deviceUI);
                                     HomePage.Instance.AddChidren(userDoorLockPage);
                                     HomePage.Instance.PageIndex += 1;
                                     userDoorLockPage.Show();
@@ -1555,7 +1562,7 @@
                                 {
                                     Tag = deviceUI
                                 };
-                                if (room.IsSharedRoom == false)
+                                if (curRoom.IsSharedRoom == false)
                                 {
                                     deviceTypeRowLayout.AddRightView(editBtn);
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1589,7 +1596,7 @@
                                 {
                                     Tag = deviceUI
                                 };
-                                if (room.IsSharedRoom == false)
+                                if (curRoom.IsSharedRoom == false)
                                 {
                                     deviceTypeRowLayout.AddRightView(editBtn);
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
@@ -1661,7 +1668,7 @@
                 if (room.IsLove)
                 {
                     roomBtn.IsSelected = true;
-                    this.room = room;
+                    this.curRoom = room;
                     curBtn = roomBtn;
 
                     if(sceneBtn.IsSelected)
@@ -1683,7 +1690,7 @@
                     (sender as Button).IsSelected = true;
                     curBtn.IsSelected = false;
                     curBtn = sender as Button;
-                    this.room = room;
+                    this.curRoom = room;
                     if (sceneBtn.IsSelected)
                     {
                         RefreshScene(room);

--
Gitblit v1.8.0