From c0021397eeb8335d6d1f20990c71533c3d94e7af Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 10 一月 2020 17:02:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |   65 ++++++++++++++++----------------
 1 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 2f4638f..40422ba 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -1130,10 +1130,9 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = light.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             functionView.CollectButton.IsSelected = false;
                                         }
@@ -1250,7 +1249,7 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(airSwitch.DeviceEpointName);
                                         functionView.IsSelected = airSwitch.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom( device.FileName));
 
                                         functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                         {
@@ -1360,7 +1359,7 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = ac.currentSystemMode != 0;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
                                         functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                         {
@@ -1471,10 +1470,9 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = dimmableLight.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             functionView.CollectButton.IsSelected = false;
                                         }
@@ -1568,10 +1566,9 @@
                                     lightView.SetStatuText(device.GetDeviceStatu());
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                     lightView.IsSelected = ias.iASInfo?.Alarm1 == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                     lightView.CanControl(false);
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1629,10 +1626,9 @@
                                         lightView.SetStatuText(device.GetDeviceStatu());
                                         lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         lightView.IsSelected = false;
-                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                         lightView.CanControl(false);
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             lightView.CollectButton.IsSelected = false;
                                         }
@@ -1655,11 +1651,10 @@
                                     lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                     lightView.SetStatuText(device.GetDeviceStatu());
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
-                                    lightView.IsSelected = dimmableLight.IsOnline == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.IsSelected = false;
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                     lightView.CanControl(false);
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1689,10 +1684,9 @@
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                     lightView.CanControl(false);
                                     //lightView.IsSelected = device.CommonDevice.IsOnline == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1722,23 +1716,29 @@
         /// <param name="functionView"></param>
         private void ReFreshEditDeviceAction(DeviceUI device, Common.Room curRoom, FunctionMainView functionView)
         {
-            if (curRoom.Id != Common.Room.CurrentRoom.Id)
+            if (Common.Room.CurrentRoom.IsLove)
             {
-                if (Common.Room.CurrentRoom.IsLove)
+                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
+                functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                if (Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                 {
-                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
-                    functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
-                }
-                else
-                {
-                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
                     ShowFunction();
                 }
             }
             else
             {
-                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
-                functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                if (curRoom.Id != Common.Room.CurrentRoom.Id)
+                {
+
+                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
+                    ShowFunction();
+                }
+                else
+                {
+                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
+                    functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                    functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
+                }
             }
         }
 
@@ -1813,8 +1813,9 @@
                     }
 
                     var sceneView = new SceneMainView(xx, yy);
-                    itemView.AddChidren(sceneView);
                     sceneView.Init(scene);
+                    itemView.AddChidren(sceneView);
+                    sceneView.CollectionAction += ShowScene;
                 }
                 GetDelayScene(sceneScrolView);
             }

--
Gitblit v1.8.0