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 |  105 ++++++++++++++++++++--------------------------------
 1 files changed, 41 insertions(+), 64 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 4be7cd0..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;
                                         }
@@ -1202,39 +1201,15 @@
                                         functionView.CardBG.MouseUpEventHandler += (sender, e) =>
                                         {
                                             CommonPage.Instance.IsDrawerLockMode = true;
-                                            if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+
+                                            var lightControl = new Phone.Device.Light.OnOffControl();
+                                            UserView.HomePage.Instance.AddChidren(lightControl);
+                                            UserView.HomePage.Instance.PageIndex += 1;
+                                            lightControl.Show(device, Room.CurrentRoom);
+                                            lightControl.action += (curDev, curRoom) =>
                                             {
-                                                var lightControl = new Phone.Device.Light.OnOffControl();
-                                                UserView.HomePage.Instance.AddChidren(lightControl);
-                                                UserView.HomePage.Instance.PageIndex += 1;
-                                                lightControl.Show(device, Room.CurrentRoom);
-                                                lightControl.action += (curDev, curRoom) =>
-                                                {
-                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
-                                                };
-                                            }
-                                            else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
-                                            {
-                                                var lightControl = new Phone.Device.Light.PlugControl();
-                                                UserView.HomePage.Instance.AddChidren(lightControl);
-                                                UserView.HomePage.Instance.PageIndex += 1;
-                                                lightControl.Show(device, Room.CurrentRoom);
-                                                lightControl.action += (curDev, curRoom) =>
-                                                {
-                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
-                                                };
-                                            }
-                                            else
-                                            {
-                                                var lightControl = new Phone.Device.Light.LightControl();
-                                                UserView.HomePage.Instance.AddChidren(lightControl);
-                                                UserView.HomePage.Instance.PageIndex += 1;
-                                                lightControl.Show(device, Room.CurrentRoom);
-                                                lightControl.action += (curDev, curRoom) =>
-                                                {
-                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
-                                                };
-                                            }
+                                                ReFreshEditDeviceAction(device, curRoom, functionView);
+                                            };
                                         };
 
                                         functionView.CollectButton.MouseUpEventHandler += collectionEvent;
@@ -1274,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) =>
                                         {
@@ -1384,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) =>
                                         {
@@ -1495,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;
                                         }
@@ -1592,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;
                                     }
@@ -1653,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;
                                         }
@@ -1679,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;
                                     }
@@ -1713,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;
                                     }
@@ -1746,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));
+                }
             }
         }
 
@@ -1837,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