From b7b3e92bed9c4553e30e2901a1877f088a5f8823 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 04 十一月 2019 17:20:52 +0800
Subject: [PATCH] 2019.11.4

---
 ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs
index 0dcac8e..15d85b2 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomHumiditySetting.cs
@@ -1,6 +1,8 @@
 锘縰sing System;
+using System.Collections.Generic;
 using Shared.Common;
 using Shared.Phone.Device.CommonForm;
+using ZigBee.Device;
 
 namespace Shared.Phone.Device.Room
 {
@@ -22,7 +24,16 @@
         /// <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
 
@@ -83,10 +94,50 @@
             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;
+                };
             }
 
         }
@@ -105,6 +156,22 @@
             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
     }
 }

--
Gitblit v1.8.0