From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs |   62 ++++++++----------------------
 1 files changed, 17 insertions(+), 45 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
index ab1221b..948b78c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -24,14 +24,6 @@
         /// </summary>
         private VerticalFrameControl listBackContr = null;
         /// <summary>
-        /// 妤煎眰椤哄簭
-        /// </summary>
-        private List<string> listFloorSort = new List<string>();
-        /// <summary>
-        /// 鎴块棿椤哄簭
-        /// </summary>
-        private List<string> listRoomSort = new List<string>();
-        /// <summary>
         /// 褰撳墠APP鐨勪綇瀹呮ā寮� 0:杩樻病鏈夎缃湁妯″紡 1:妤煎眰妯″紡 2:娌℃湁妤煎眰妯″紡
         /// </summary>
         private int AppResidenceMode = 0;
@@ -282,23 +274,17 @@
         {
             //鑾峰彇妤煎眰
             var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
-            this.listFloorSort.Clear();
-            foreach (string keys in dicFloor.Keys)
-            {
-                listFloorSort.Add(keys);
-            }
-
-            if (Common.Config.Instance.Home.FloorDics.Count == 0)
+            if (dicFloor.Count == 0)
             {
                 return;
             }
             HdlThreadLogic.Current.RunMainInThread(() =>
             {
-                int count = listFloorSort.Count - 1;
-                for (int i = 0; i < listFloorSort.Count; i++)
+                int count = dicFloor.Count;
+                foreach (var keys in dicFloor.Keys)
                 {
-                    string keys = listFloorSort[i];
-                    this.AddFloorRow(keys, dicFloor[keys], i != count);
+                    count--;
+                    this.AddFloorRow(keys, dicFloor[keys], count != 0);
                 }
                 //璋冩暣鎺т欢楂樺害
                 this.AdjustContrlTableHeight();
@@ -366,11 +352,11 @@
                         Common.Config.Instance.Home.FloorDics.Remove(keys);
                         if (Common.Config.Instance.Home.CurrentFloorId == keys)
                         {
-                            //濡傛灉鍒犻櫎鐨勬槸褰撳墠妤煎眰鐨勮瘽
                             Common.Config.Instance.Home.CurrentFloorId = string.Empty;
-                            foreach (string floorId in Common.Config.Instance.Home.FloorDics.Keys)
+                            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+                            foreach (var floorId in dicFloor.Keys)
                             {
-                                //鎶婄涓�涓ゼ灞侷D缁欏畠
+                                //鎶婄涓�涓ゼ灞傝祴鍊肩粰褰撳墠妤煎眰
                                 Common.Config.Instance.Home.CurrentFloorId = floorId;
                                 break;
                             }
@@ -392,9 +378,6 @@
                             HdlRoomLogic.Current.RemoveRoom(roomId);
                         }
                         Common.Config.Instance.Home.Save();
-                        //淇濆瓨椤哄簭
-                        listFloorSort.Remove(keys);
-                        HdlRoomLogic.Current.SaveFloorSort(listFloorSort);
 
                         if (Common.Config.Instance.Home.FloorDics.Count == 0)
                         {
@@ -423,7 +406,7 @@
                             this.AdjustContrlTableHeight();
                         }
                         //鍒犻櫎妤煎眰鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-                        UserView.UserPage.Instance.RefreshForm = true;
+                        UserView.UserPage.Instance.RefreshAllForm = true;
                     });
                 };
             }
@@ -481,7 +464,6 @@
                     Common.Config.Instance.Home.Save();
                     if (Common.Config.Instance.Home.CurrentFloorId == string.Empty)
                     {
-                        Common.Config.Instance.Home.CurrentFloorId = keys;
                         //鍒涘缓绗竴涓柊鐨勬ゼ灞傜殑璇�,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛�
                         HdlRoomLogic.Current.RefreshRoomListView();
                     }
@@ -495,7 +477,7 @@
                         this.InitFrameTableByMode();
                     }
                     //鍒涘缓鎴栬�呬慨鏀规ゼ灞傜殑璇�,涓婚〉闇�瑕侀噸鏂板埛鏂�
-                    UserView.UserPage.Instance.RefreshForm = true;
+                    UserView.UserPage.Instance.RefreshAllForm = true;
                 }
             });
         }
@@ -540,12 +522,6 @@
         {
             //鑾峰彇妤煎眰鐨勬埧闂�
             var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty);
-            this.listRoomSort.Clear();
-            for (int i = 0; i < listRoom.Count; i++)
-            {
-                this.listRoomSort.Add(listRoom[i].Id);
-            }
-
             for (int i = 0; i < listRoom.Count; i++)
             {
                 //娣诲姞鎴块棿琛�
@@ -593,7 +569,6 @@
                 //濡傛灉鏄垎浜殑鎴块棿锛屼笉鑳界紪杈戝拰淇敼
                 return;
             }
-
             //缂栬緫
             var btnEditor = frameRow.AddEditorControl();
             btnEditor.ButtonClickEvent += (sender, e) =>
@@ -614,9 +589,6 @@
                 this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteRoomMsg), () =>
                 {
                     HdlRoomLogic.Current.RemoveRoom(room.Id);
-                    //淇濆瓨椤哄簭
-                    this.listRoomSort.Remove(room.Id);
-                    HdlRoomLogic.Current.SaveRoomSort(string.Empty, this.listRoomSort);
 
                     var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
                     if (listAllRoom.Count <= 1)
@@ -646,7 +618,7 @@
                         this.AdjustContrlTableHeight();
                     }
                     //鍒犻櫎鎴块棿鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-                    UserView.UserPage.Instance.RefreshForm = true;
+                    UserView.UserPage.Instance.RefreshAllForm = true;
                 });
             };
         }
@@ -658,7 +630,7 @@
         /// <summary>
         /// 鍒犻櫎浣忓畢
         /// </summary>
-        public async void DeleteResidence()
+        private void DeleteResidence()
         {
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
@@ -670,7 +642,7 @@
                 Pra.HomeId = Common.Config.Instance.Home.Id;
                 Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
 
-                bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
+                bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
                 if (result == false)
                 {
                     //鍏抽棴杩涘害鏉�
@@ -686,7 +658,7 @@
                     HomeId = Common.Config.Instance.Home.Id,
                     PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
                 };
-                bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
+                bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
                 if (result == false)
                 {
                     //鍏抽棴杩涘害鏉�
@@ -725,7 +697,7 @@
             Common.Config.Instance.Save();
 
             //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-            await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
+            UserCenterLogic.InitUserCenterMenmoryAndThread(false);
 
             //鍒犻櫎浣忓畢
             HdlResidenceLogic.Current.DeleteHouseMemmory(deleteId);
@@ -748,7 +720,7 @@
         /// <param name="latitude">绾害</param>
         /// <param name="longitude">缁忓害</param>
         /// <param name="addresName">浣嶇疆鍚嶇О</param>
-        private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
+        private void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
         {
             //濡傛灉涓嶆槸铏氭嫙浣忓畢,鎵嶆洿鏂颁簯绔�
             if (Common.Config.Instance.Home.IsVirtually == false)
@@ -764,7 +736,7 @@
                 Pra.Longitude = longitude;
 
                 //缂栬緫浣忓畢
-                bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
+                bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
                 if (flage == false)
                 {
                     //鍏抽棴杩涘害鏉�

--
Gitblit v1.8.0