From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |   99 ++++++++++++++++++++++++-------------------------
 1 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 2f4638f..44eaab9 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;
@@ -1018,7 +1010,7 @@
                                         functionView.Init();
                                         functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         functionView.SetStatuText(device.GetDeviceStatu());
-                                        functionView.SetDeviceName(rollerShade.DeviceEpointName);
+                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(rollerShade));
                                         functionView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100;
                                         functionView.SetCollect(true);
 
@@ -1086,6 +1078,7 @@
                                             UserView.HomePage.Instance.AddChidren(rollerShadeControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
                                             UserView.HomePage.Instance.ScrollEnabled = false;
+                                            rollerShadeControl.IsDrawerLockMode = true;
                                             rollerShadeControl.Show(device, Room.CurrentRoom);
                                             rollerShadeControl.action += (curDev, curRoom) =>
                                             {
@@ -1128,12 +1121,11 @@
                                         functionView.Tag = device;
                                         functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         functionView.SetStatuText(device.GetDeviceStatu());
-                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                         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;
                                         }
@@ -1206,6 +1198,7 @@
                                             var lightControl = new Phone.Device.Light.OnOffControl();
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
+                                            lightControl.IsDrawerLockMode = true;
                                             lightControl.Show(device, Room.CurrentRoom);
                                             lightControl.action += (curDev, curRoom) =>
                                             {
@@ -1248,9 +1241,9 @@
                                         functionView.Tag = device;
                                         functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         functionView.SetStatuText(device.GetDeviceStatu());
-                                        functionView.SetDeviceName(airSwitch.DeviceEpointName);
+                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(airSwitch));
                                         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) =>
                                         {
@@ -1315,6 +1308,7 @@
                                             var lightControl = new Phone.Device.Light.AirSwitchControl();
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
+                                            lightControl.IsDrawerLockMode = true;
                                             lightControl.Show(device, Room.CurrentRoom);
                                             lightControl.action += (curDev, curRoom) =>
                                             {
@@ -1358,9 +1352,9 @@
                                         functionView.Tag = device;
                                         functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         functionView.SetStatuText(device.GetDeviceStatu());
-                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                         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) =>
                                         {
@@ -1425,6 +1419,7 @@
                                             var lightControl = new Phone.Device.AC.ACControl();
                                             UserView.HomePage.Instance.AddChidren(lightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
+                                            lightControl.IsDrawerLockMode = true;
                                             lightControl.Show(device, Room.CurrentRoom);
                                             lightControl.action += (curDev, curRoom) =>
                                             {
@@ -1469,12 +1464,11 @@
                                         functionView.Tag = device;
                                         functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         functionView.SetStatuText(device.GetDeviceStatu());
-                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                         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;
                                         }
@@ -1546,6 +1540,7 @@
                                             var dimmableLightControl = new Phone.Device.Light.DimmableLightControl();
                                             UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                                             UserView.HomePage.Instance.PageIndex += 1;
+                                            dimmableLightControl.IsDrawerLockMode = true;
                                             dimmableLightControl.Show(device, Room.CurrentRoom);
                                             dimmableLightControl.action += (curDev, curRoom) =>
                                             {
@@ -1566,12 +1561,11 @@
                                     lightView.Tag = device;
                                     lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                     lightView.SetStatuText(device.GetDeviceStatu());
-                                    lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                    lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                     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;
                                     }
@@ -1627,12 +1621,11 @@
                                         lightView.Tag = device;
                                         lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                         lightView.SetStatuText(device.GetDeviceStatu());
-                                        lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                        lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                         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;
                                         }
@@ -1654,12 +1647,11 @@
                                     lightView.Tag = device;
                                     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.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
+                                    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;
                                     }
@@ -1686,13 +1678,11 @@
                                     lightView.Tag = device;
                                     lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                     lightView.SetStatuText(device.GetDeviceStatu());
-                                    lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                                    lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                     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 +1712,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(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
+                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(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
+                    functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
+                }
             }
         }
 
@@ -1813,8 +1809,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