From dee21bf452a8979d0515d13e534fbb69ed9715dd Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 01 九月 2020 15:33:13 +0800
Subject: [PATCH] 上传一个版本

---
 ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs |   65 +++++++++++++++++---------------
 1 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs
index 636fc83..0b5571f 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs
@@ -74,9 +74,6 @@
                 listBodyContr.RecoverTableHeight();
             }
 
-            //鍒濆鍖栭粯璁ゆゼ灞侷D
-            this.InitDefultFloorId();
-
             //鍒濆鍖栧ご閮ㄦ帶浠�
             this.InitTopFrameLayoutControl();
             //鍒濆鍖栦腑闂存帶浠�
@@ -628,6 +625,11 @@
                     {
                         cardContr = new Controls.DeviceFreshAirCardControl();
                     }
+                    // PM2.5
+                    else if (device.Type == DeviceType.PMSensor)
+                    {
+                        cardContr = new Controls.DevicePmSensorCardControl();
+                    }
                     //褰╃伅(璋冨厜鍣�)
                     else if (device.Type == DeviceType.DimmableLight)
                     {
@@ -695,17 +697,31 @@
                         }
                         HdlThreadLogic.Current.RunThread(() =>
                         {
-                            for (int i = 0; i < listContr.Count; i++)
+                            while (listDeviceBackContr.Parent != null)
                             {
-                                if (listDeviceBackContr.Parent == null)
+                                bool hadSend = false;
+                                for (int i = 0; i < listContr.Count; i++)
                                 {
-                                    return;
+                                    if (listDeviceBackContr.Parent == null)
+                                    {
+                                        return;
+                                    }
+                                    //濡傛灉杩樻病鏈夋帴鏀跺埌鏁版嵁,鍒欏啀娆″彂閫�
+                                    if (listContr[i].ReceiveResponeResultStatu() == false)
+                                    {
+                                        //鍙戦�佽幏鍙栫姸鎬佺殑鍛戒护
+                                        listContr[i].SendStatuComand();
+                                        hadSend = true;
+                                        System.Threading.Thread.Sleep(200);
+                                    }
                                 }
-                                System.Threading.Thread.Sleep(200);
-                                //鍙戦�佽幏鍙栫姸鎬佺殑鍛戒护
-                                listContr[i].SendStatuComand();
+                                if (hadSend == false)
+                                {
+                                    //濡傛灉宸茬粡鍏ㄩ儴鍥炶矾閮芥帴鏀朵簡缃戝叧鍥炲,鍒欎笉鍐嶄簩娆″彂閫�
+                                    break;
+                                }
+                                System.Threading.Thread.Sleep(2000);
                             }
-
                         }, ShowErrorMode.NO);
                     }
                 });
@@ -1068,13 +1084,15 @@
                 this.ShowProgressBar();
 
                 //鍒囨崲浣忓畢
-                HdlResidenceLogic.Current.SwitchResidence(home.Id);
+                var result = HdlResidenceLogic.Current.SwitchResidence(home.Id);
 
                 HdlThreadLogic.Current.RunMain(() =>
                 {
-                    //鍒锋柊鐣岄潰
-                    this.ShowForm();
-
+                    if (result == true)
+                    {
+                        //鍒锋柊鐣岄潰
+                        this.ShowForm();
+                    }
                     this.CloseProgressBar();
                 });
             });
@@ -1188,6 +1206,8 @@
                                     //璁惧鐘舵�佸繀椤诲埛鏂�
                                     string statuText = HdlDeviceOtherLogic.Current.GetDeviceStatu(contr.device);
                                     contr.SetDeviceStatuText(statuText);
+                                    //浼犳劅鍣ㄥ垏鎹负鐏拌壊鐘舵��
+                                    contr.SwitchCardStatuAppeal(false);
 
                                 }, ShowErrorMode.NO);
                             }
@@ -1258,23 +1278,6 @@
                 return false;
             }
             return true;
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栭粯璁ゆゼ灞侷D
-        /// </summary>
-        private void InitDefultFloorId()
-        {
-            if (Config.Instance.Home.CurrentFloorId != string.Empty)
-            {
-                return;
-            }
-            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
-            foreach (var floorId in dicFloor.Keys)
-            {
-                Config.Instance.Home.CurrentFloorId = floorId;
-                break;
-            }
         }
 
         #endregion

--
Gitblit v1.8.0