From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 16 十二月 2020 13:09:08 +0800
Subject: [PATCH] 新云端代码Ver1.2

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs |   50 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs
index afd1449..5dadc7f 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs
@@ -24,6 +24,10 @@
         /// 婵�娲荤殑璁惧鍦板潃
         /// </summary>
         private string actionDeviceKeys = null;
+        /// <summary>
+        /// 鎺ユ敹鍥炲鐨勭鐐�
+        /// </summary>
+        private HashSet<int> listReceivePoint = new HashSet<int>();
 
         #endregion
 
@@ -35,7 +39,12 @@
         /// <param name="i_diviceMac">璁惧Mac鍦板潃</param>
         public void ShowForm(string i_diviceMac)
         {
-            this.listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_diviceMac);
+            this.listDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(i_diviceMac);
+            //鏀堕泦鍏ㄩ儴绔偣
+            foreach (var device in this.listDevice)
+            {
+                listReceivePoint.Add(device.DeviceEpoint);
+            }
             //璁剧疆澶撮儴淇℃伅
             base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uIndoorUnitSettion));
 
@@ -107,14 +116,14 @@
 
             var btnIcon = new IconViewControl(78);
             btnIcon.Gravity = Gravity.Center;
-            Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
+            HdlDeviceCommonLogic.Current.SetDeviceIconToControl(btnIcon, device);
             btnIconBack.AddChidren(btnIcon);
             frameTable.ChangedChidrenBindMode(btnIconBack, ChidrenBindMode.BindEvent);
             rowInfo.btnIcon = btnIcon;
 
             //璁惧鍚嶇О
             var btnDeviceName = new NormalViewControl(700, 60, true);
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
+            btnDeviceName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
             btnDeviceName.X = Application.GetRealWidth(193);
             btnDeviceName.Y = Application.GetRealHeight(45);
             frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
@@ -217,13 +226,13 @@
 
             frameTable.ButtonClickEvent += (sender, e) =>
             {
-                this.actionDeviceKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+                this.actionDeviceKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
 
                 var form = new IndoorUnitSettionForm();
                 form.AddForm(device);
             };
 
-            dicControl[Common.LocalDevice.Current.GetDeviceMainKeys(device)] = rowInfo;
+            dicControl[HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device)] = rowInfo;
         }
 
         #endregion
@@ -242,15 +251,24 @@
             }
             HdlThreadLogic.Current.RunThread(() =>
             {
-                for (int i = 0; i < listDevice.Count; i++)
+                while (this.listReceivePoint.Count > 0 && this.Parent != null)
                 {
-                    if (this.Parent == null)
+                    for (int i = 0; i < listDevice.Count; i++)
                     {
-                        return;
+                        if (this.Parent == null)
+                        {
+                            return;
+                        }
+                        //宸茬粡鍙戦�佽繃浜�,灏变笉鐢ㄥ啀鍙戦��
+                        if (this.listReceivePoint.Contains(listDevice[i].DeviceEpoint) == true)
+                        {
+                            //璇诲彇鐘舵��
+                            HdlDeviceAttributeLogic.Current.SendThermostatStatuComand(listDevice[i]);
+                            System.Threading.Thread.Sleep(200);
+                        }
                     }
-                    //璇诲彇鐘舵��
-                    HdlDeviceAttributeLogic.Current.SendThermostatStatuComand(listDevice[i]);
-                    System.Threading.Thread.Sleep(200);
+                    //3绉掑悗鍐嶆寰幆
+                    System.Threading.Thread.Sleep(3000);
                 }
             });
         }
@@ -266,16 +284,18 @@
         {
             HdlGatewayReceiveLogic.Current.AddAttributeEvent("IndoorUnitListFormEvent", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) =>
             {
-                string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+                string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
                 if (dicControl.ContainsKey(mainkeys) == false || device.DeviceStatusReport.CluterID != 513)
                 {
                     return;
                 }
-                var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
+                var localDevice = HdlDeviceCommonLogic.Current.GetDevice(mainkeys);
                 if (localDevice == null)
                 {
                     return;
                 }
+                //宸茬粡鎺ユ敹鍒版暟鎹�,鍒欑Щ闄ょ鐐�
+                this.listReceivePoint.Remove(device.DeviceEpoint);
 
                 var rowInfo = dicControl[mainkeys];
                 for (int i = 0; i < device.DeviceStatusReport.AttriBute.Count; i++)
@@ -354,11 +374,11 @@
             if (this.actionDeviceKeys != null && dicControl.ContainsKey(this.actionDeviceKeys) == true)
             {
                 //鍒锋柊璁惧淇℃伅
-                var device = Common.LocalDevice.Current.GetDevice(this.actionDeviceKeys);
+                var device = HdlDeviceCommonLogic.Current.GetDevice(this.actionDeviceKeys);
                 if (device != null)
                 {
                     var contr = dicControl[this.actionDeviceKeys];
-                    contr.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
+                    contr.btnDeviceName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
                     contr.btnRoom.Text = HdlRoomLogic.Current.GetRoomNameByDevice(device);
                 }
             }

--
Gitblit v1.8.0