From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs |   62 +++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
index d456bd7..e29dbd2 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -141,7 +141,7 @@
                 //鍋滄鎺ユ敹
                 this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
 
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     this.CloseForm();
                 });
@@ -183,9 +183,6 @@
             //鍒锋柊瓒呮椂鏃堕棿
             this.waitDeviceTimeOut = 20;
 
-            //鑾峰彇璁惧鐨勫浐瀹氬睘鎬�
-            HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device);
-
             //涓嶉渶瑕�200绔偣鐨勯偅涓澶�  2020.01.13 鍙樻洿:ota涔熷姞杩涙潵
             this.listNewDevice.Add(device);
 
@@ -221,26 +218,36 @@
                 this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
                 System.Threading.Thread.Sleep(200);
 
-                //鐩墠灏卞紕涓�涓�
-                Application.RunOnMainThread(() =>
+                var listDevice = new List<CommonDevice>();
+                for (int i = 0; i < this.listNewDevice.Count; i++)
                 {
-                    var listDevice = new List<CommonDevice>();
-                    for (int i = 0; i < this.listNewDevice.Count; i++)
+                    var device = this.listNewDevice[i];
+                    if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr)
                     {
-                        var device = this.listNewDevice[i];
-                        if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr)
-                        {
-                            continue;
-                        }
-                        listDevice.Add(device);
-                        //閲嶆柊鍙樻洿UI
-                        if (device is OTADevice)
-                        {
-                            continue;
-                        }
-                        device.IconPath = string.Empty;
-                        device.ReSave();
+                        continue;
                     }
+                    listDevice.Add(device);
+                    //閲嶆柊鍙樻洿UI
+                    if (device is OTADevice)
+                    {
+                        continue;
+                    }
+                    device.IconPath = string.Empty;
+                    device.ReSave();
+
+                    //璁剧疆璁惧鍔熻兘绫诲瀷 (涓嶈兘鍦ㄦ帴鏀跺洖璺殑鍦版柟鍐欏叆,涓嶇劧缃戝叧鍙兘浼氳秴璐熻嵎)
+                    Common.LocalDevice.Current.RefreshDeviceFunctionType(device, device, true);
+                    System.Threading.Thread.Sleep(200);
+                    //鑾峰彇璁惧鐨勫浐瀹氬睘鎬�
+                    if (HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device) == true)
+                    {
+                        System.Threading.Thread.Sleep(200);
+                    }
+                }
+
+                //鐩墠灏卞紕涓�涓�
+                HdlThreadLogic.Current.RunMain(() =>
+                {
                     //鏄剧ず璁惧淇℃伅鐢婚潰
                     this.ShowDeviceAddSuccessForm(listDevice);
                 });
@@ -315,7 +322,7 @@
                             timeCount = 0;
                         }
                     }
-                    Application.RunOnMainThread(() =>
+                    HdlThreadLogic.Current.RunMain(() =>
                     {
                         if (btnRound != null)
                         {
@@ -439,6 +446,15 @@
             else if (topic == gatewayId + "/DeviceInComingRespon")
             {
                 this.topTimeOut = topMaxTime;
+
+                //璁惧鍏ョ綉鏃�,鏈夋椂鍊欑綉鍏充細涓婃姤铏氭嫙璁惧
+                var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData);
+                CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString());
+                if (info.DriveCode != 0)
+                {
+                    //涓嶉渶瑕佽櫄鎷熻澶�
+                    return 0;
+                }
                 //缃戝叧鏈�缁堜笂鎶ヨ妭鐐硅澶囦俊鎭�
                 this.btnProgressBar.SetValue(6, 6);
                 return 1;
@@ -468,7 +484,7 @@
                 {
                     //鍝嶅簲瓒呮椂,璇烽噸鏂板叆缃�
                     this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uResponseTimeoutsAndReAccessNetwork));
-                    Application.RunOnMainThread(() =>
+                    HdlThreadLogic.Current.RunMain(() =>
                     {
                         //鍏抽棴鐣岄潰
                         this.CloseForm();

--
Gitblit v1.8.0