| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.Device.Room |
| | | { |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action<string> action; |
| | | public Action<CommonDevice> selectDeviceAction; |
| | | |
| | | /// <summary> |
| | | /// tempDeviceRow |
| | | /// </summary> |
| | | private DeviceInfoWithZoneRow tempDeviceRow = null; |
| | | /// <summary> |
| | | /// tempDevice |
| | | /// </summary> |
| | | public CommonDevice tempDevice; |
| | | |
| | | #endregion |
| | | |
| | |
| | | var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127); |
| | | confirm.SetTitle(R.MyInternationalizationString.Save); |
| | | AddChidren(confirm); |
| | | |
| | | for (int i = 0; i < 15; i++) |
| | | confirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | AddItem(verticalScrolView, 20 + i * (127 + 20)); |
| | | RemoveFromParent(); |
| | | if (tempDevice != null) |
| | | { |
| | | selectDeviceAction?.Invoke(tempDevice); |
| | | } |
| | | }; |
| | | |
| | | var deviceList = GetHumidityDevice(); |
| | | |
| | | for (int i = 0; i < deviceList.Count; i++) |
| | | { |
| | | var device = deviceList[i]; |
| | | var devRow = new DeviceInfoWithZoneRow(20 + i * (127 + 20)); |
| | | verticalScrolView.AddChidren(devRow); |
| | | devRow.Init(); |
| | | devRow.SetIcon(device.IconPath); |
| | | devRow.SetName(device.DeviceName); |
| | | devRow.SetZone(room.FloorName + ", " + room.Name); |
| | | |
| | | if (tempDevice != null && tempDevice == device) |
| | | { |
| | | tempDeviceRow = devRow; |
| | | tempDevice = device; |
| | | devRow.SetStatu(true); |
| | | } |
| | | else |
| | | { |
| | | if (i == 0 && tempDevice == null) |
| | | { |
| | | tempDeviceRow = devRow; |
| | | tempDevice = device; |
| | | devRow.SetStatu(true); |
| | | } |
| | | } |
| | | |
| | | devRow.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | tempDeviceRow.SetStatu(false); |
| | | devRow.SetStatu(true); |
| | | tempDeviceRow = devRow; |
| | | tempDevice = device; |
| | | }; |
| | | } |
| | | |
| | | } |
| | |
| | | dev.SetZone(room.FloorName + ", " + room.Name); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 湿度传感器列表 |
| | | /// </summary> |
| | | private List<ZigBee.Device.CommonDevice> GetHumidityDevice() |
| | | { |
| | | var listDevice = new List<ZigBee.Device.CommonDevice>(); |
| | | foreach (var device in Common.LocalDevice.Current.listAllDevice) |
| | | { |
| | | //获取湿度传感器 |
| | | if (device is ZigBee.Device.TemperatureSensor && ((ZigBee.Device.TemperatureSensor)device).SensorDiv == 2) |
| | | { |
| | | listDevice.Add(device); |
| | | } |
| | | } |
| | | return listDevice; |
| | | } |
| | | #endregion |
| | | } |
| | | } |