From 16604a593202f2f87adf71abd57d036fe7da3b52 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 18 十一月 2019 10:39:42 +0800 Subject: [PATCH] 同步了全部的代码 --- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 91 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 70 insertions(+), 21 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 804648d..72d7fa7 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -4,6 +4,7 @@ using Shared.Phone.Device.AC; using ZigBee.Device; using Shared.Phone.Device.CommonForm; +using Shared.Phone.UserCenter.DoorLock; namespace Shared.Phone.UserView { @@ -639,7 +640,8 @@ roomPageView.AddChidren(roomBackView); var roomBG = new Button() { - UnSelectedImagePath = "Room/HomeBG.png", + //UnSelectedImagePath = "Room/HomeBG.png", + UnSelectedImagePath = room.BackgroundImage }; roomBackView.AddChidren(roomBG); var roomName = new Button() @@ -661,24 +663,11 @@ Width = Application.GetMinRealAverage(100), Height = Application.GetMinRealAverage(100), UnSelectedImagePath = "Item/List.png", - SelectedImagePath = "Item/ListSelected.png" }; roomBackView.AddChidren(roomListBtn); roomListBtn.MouseUpEventHandler += (send, e) => { - //var roomList = new Device.Room.RoomManagement(); - //HomePage.Instance.AddChidren(roomList); - //HomePage.Instance.PageIndex += 1; - //roomList.Show(); - //roomList.action += () => - //{ - // Show(); - //}; - if(room.IsLove) - { - return; - } var editRoom = new Device.Room.EditRoom(); HomePage.Instance.AddChidren(editRoom); HomePage.Instance.PageIndex += 1; @@ -687,7 +676,6 @@ { Show(); }; - }; } } @@ -713,7 +701,7 @@ Text = Language.StringByID(R.MyInternationalizationString.Favorite), TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.GXCTextWhiteColor, - TextSize = 18, + TextSize = 18 }; roomBackView.AddChidren(roomName); var roomListBtn = new Button() @@ -1021,7 +1009,6 @@ deviceVerticalScrolViewLayout.AddChidren(itemView); } - //鍒犻櫎璁惧 EventHandler<MouseEventArgs> delEvent = (sender, e) => { @@ -1627,14 +1614,65 @@ var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); UserView.HomePage.Instance.AddChidren(dimmableLightControl); UserView.HomePage.Instance.PageIndex += 1; - UserView.HomePage.Instance.ScrollEnabled = false; //dimmableLightControl.action = RefreshBodyView; dimmableLightControl.Show(device, Room.CurrentRoom); }; lightView.CollectButton.MouseUpEventHandler += collectionEvent; } - else if (device.CommonDevice.Type == DeviceType.OnOffSwitch) + else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.DoorLock) + { + //闂ㄩ攣 + var dimmableLight = device.CommonDevice as DoorLock; + //琛ヤ笂闈炶繙绋� + if (dimmableLight.Gateway == null) + { + continue; + } + if (dimmableLight.Gateway.IsVirtual) + { + ReadStatus(dimmableLight, () => + { + dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + }); + } + else + { + if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) + { + dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + } + } + + var lightView = new FunctionMainView(xx, yy); + itemView.AddChidren(lightView); + lightView.Init(); + 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.CanControl(false); + var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); + if (dev == null) + { + lightView.CollectButton.IsSelected = false; + } + else + { + lightView.CollectButton.IsSelected = true; + } + + lightView.CardBG.MouseUpEventHandler += (sender, e) => + { + var userDoorLockPage = new UserDoorLockPage(Room.CurrentRoom,device); + HomePage.Instance.AddChidren(userDoorLockPage); + HomePage.Instance.PageIndex += 1; + userDoorLockPage.Show(); + }; + lightView.CollectButton.MouseUpEventHandler += collectionEvent; + } + else { var lightView = new FunctionMainView(xx, yy); itemView.AddChidren(lightView); @@ -1642,9 +1680,20 @@ lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); lightView.SetStatuText(device.GetDeviceStatu()); lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); - //lightView.SetStatu(true); - lightView.IsSelected = true; + lightView.CanControl(false); + lightView.IsSelected = device.CommonDevice.IsOnline == 1; lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); + + var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); + if (dev == null) + { + lightView.CollectButton.IsSelected = false; + } + else + { + lightView.CollectButton.IsSelected = true; + } + lightView.CollectButton.MouseUpEventHandler += collectionEvent; } } } -- Gitblit v1.8.0