From b9cb076fe6127160c96c35bf9c8cebcffe1d5ccd Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 10 一月 2020 17:35:23 +0800
Subject: [PATCH] 2020.1.10

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |   75 +++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 41 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 2f4638f..8cacd09 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -255,14 +255,6 @@
                                                         ac.currentSystemMode = attList.AttriButeData;
                                                         ac.LastDateTime = DateTime.Now;
                                                         break;
-                                                    case 4099:
-                                                        var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
-                                                        var modeStr = value.Substring(value.Length - 5, 5);
-                                                        for (int k = 0; k < modeStr.Length; k++)
-                                                        {
-                                                            ac.listSupportMode[k] = Convert.ToInt32(modeStr[k]) == 49 ? 1 : 0;
-                                                        }
-                                                        break;
                                                 }
                                             }
                                             (rowFL.GetChildren(j) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
@@ -936,7 +928,7 @@
                 var dList = new List<DeviceUI> { };
                 foreach(var device in deviceList)
                 {
-                    var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice });
+                    var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice);
                     if (info.BeloneType == DeviceBeloneType.A骞叉帴鐐� || info.BeloneType == DeviceBeloneType.A涓户鍣�)
                     {
                         continue;
@@ -1130,10 +1122,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 +1241,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 +1351,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 +1462,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 +1558,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 +1618,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 +1643,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 +1676,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 +1708,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 +1805,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