From 05ce435c3b58e53eeab04c672affdeeab75f3036 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 14:41:39 +0800
Subject: [PATCH] 2019.11.15-1
---
ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 72 +++++++++++++++++++++++++++++++++--
1 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 21003fa..3ee1dd4 100644
--- 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
{
@@ -1008,7 +1009,6 @@
deviceVerticalScrolViewLayout.AddChidren(itemView);
}
-
//鍒犻櫎璁惧
EventHandler<MouseEventArgs> delEvent = (sender, e) =>
{
@@ -1614,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);
@@ -1629,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