From ddb46a700775aacfb6cc82d9586302a38c8fa0a7 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 23 十二月 2019 09:13:37 +0800
Subject: [PATCH] 2019.12.23

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |   68 ++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 75b3e76..9ebea2a 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -85,7 +85,7 @@
         /// <summary>
         /// 鍔熻兘绫诲瀷鎸夐挳
         /// </summary>
-        private FunctionButton functionTypeIMG;
+        //private FunctionButton functionTypeIMG;
         /// <summary>
         /// 鍔熻兘绫诲瀷
         /// </summary>
@@ -93,7 +93,7 @@
         /// <summary>
         /// 璁惧绫诲瀷RowLayout
         /// </summary>
-        private FrameLayout typeRowLayout;
+        //private FrameLayout typeRowLayout;
         /// <summary>
         /// 妤煎眰
         /// </summary>
@@ -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;
             }
         }
@@ -904,9 +911,9 @@
                 deviceListScrolView = new VerticalScrolViewLayout
                 {
                     X = Application.GetRealWidth(CommonFormResouce.X_Left),
-                    Y = Application.GetRealHeight(35+275),
+                    Y = Application.GetRealHeight(35+279),
                     Width = Application.GetRealWidth(1028),
-                    Height = Application.GetRealHeight(939),
+                    Height = Application.GetRealHeight(942),
                     BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
                 };
                 functionSceneBodyView.AddChidren(deviceListScrolView);
@@ -917,13 +924,13 @@
 
                 foreach (var deviceType in typeIdDic)
                 {
-                    typeRowLayout = new FrameLayout()
+                    var typeRowLayout = new FrameLayout()
                     {
                         Width = Application.GetRealWidth(220),
                     };
                     functionTypeScrowView.AddChidren(typeRowLayout);
 
-                    functionTypeIMG = new FunctionButton()
+                    var functionTypeIMG = new FunctionButton()
                     {
                         Tag = deviceType.Key
                     };
@@ -936,7 +943,7 @@
 
                     functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction;
 
-                    if (typeRowLayout.ChildrenCount == 1)
+                    if (functionTypeScrowView.ChildrenCount == 1)
                     {
                         ShowSameTypeFunction(functionTypeIMG.ImageBtn, null);
                     }
@@ -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,9 +1668,8 @@
                 if (room.IsLove)
                 {
                     roomBtn.IsSelected = true;
-                    this.room = room;
+                    this.curRoom = room;
                     curBtn = roomBtn;
-
                     if(sceneBtn.IsSelected)
                     {
                         RefreshScene(room);
@@ -1683,7 +1689,7 @@
                     (sender as Button).IsSelected = true;
                     curBtn.IsSelected = false;
                     curBtn = sender as Button;
-                    this.room = room;
+                    this.curRoom = room;
                     if (sceneBtn.IsSelected)
                     {
                         RefreshScene(room);
@@ -1713,8 +1719,8 @@
         /// <param name="room"></param>
         public void RefreshScene(Common.Room room)
         {
+            RefreshData(room);
             functionSceneBodyView.RemoveAll();
-            var sceneList = room.SceneUIList;
             if (sceneList.Count == 0)
             {
                 ShowNoSceneTip();

--
Gitblit v1.8.0