From f534d41c36d5895322bf691784a10435b64609fe Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 25 十二月 2020 13:52:00 +0800
Subject: [PATCH] 修复添加、删除楼层时候,界面刷新异常问题

---
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs |   60 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
index 2751883..25f51cf 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
@@ -78,7 +78,7 @@
                 TextColor = CSS_Color.TextualColor,
                 SelectedTextColor = CSS_Color.MainColor,
                 Text = floor.roomName,
-                Tag = floor.roomId,
+                Tag = floor.uid,
             };
             row.AddChidren(btnFloor);
 
@@ -92,22 +92,54 @@
 
         void RefreshFloorsListView(string floorName)
         {
-            try
+
+            var waitPage = new Loading();
+            MainPage.BaseView.AddChidren(waitPage);
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
+            new System.Threading.Thread(() =>
             {
-                var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = UserInfo.Current.CurReginID };
-                var addResult = SpatialInfo.CurrentSpatial.AddFloor(f);
-                if (addResult == DAL.Server.StateCode.SUCCESS)
+                try
                 {
-                    LoadFloorRow(f);
+                    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
+                    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f);
+                    if (addResult == DAL.Server.StateCode.SUCCESS)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            LoadFloorRow(f);
+                        });
+                    }
                 }
-            }
-            catch (Exception ex)
-            {
-                MainPage.Log("add floor eroor : " + ex.Message);
-            }
-            int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
-            floorsListView.Height = Application.GetRealHeight(50 * count);
-            contentView.Height = Application.GetRealHeight(50 * (count + 1));
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() => {
+                        waitPage.Hide();
+                        waitPage.RemoveFromParent();
+                        int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
+                        floorsListView.Height = Application.GetRealHeight(50 * count);
+                        contentView.Height = Application.GetRealHeight(50 * (count + 1));
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+
+            //try
+            //{
+            //    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
+            //    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
+            //    if (addResult == DAL.Server.StateCode.SUCCESS)
+            //    {
+            //        LoadFloorRow(f);
+            //    }
+            //}
+            //catch (Exception ex)
+            //{
+            //    MainPage.Log("add floor eroor : " + ex.Message);
+            //}
+            //int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
+            //floorsListView.Height = Application.GetRealHeight(50 * count);
+            //contentView.Height = Application.GetRealHeight(50 * (count + 1));
         }
 
         public void LoadPage()

--
Gitblit v1.8.0