From adc150efb13a0506f45a3c344c3ee2ef2dba8e90 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:19:13 +0800
Subject: [PATCH] 合并嘉乐lc代码

---
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs |  105 +++++++++++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 50 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
index 93b7906..de7355a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
@@ -10,7 +10,7 @@
         /// <summary>
         /// 妤煎眰鎸夐挳淇敼鍚嶇О鐐瑰嚮浜嬩欢
         /// </summary>
-        void LoadEvent_FloorNamgeChange(Button btn,Button btnDel,RowLayout row,SpatialInfo floor)
+        void LoadEvent_FloorNamgeChange(Button btn,SpatialInfo floor)
         {
             btn.MouseUpEventHandler = (sender, e) =>
             {
@@ -33,11 +33,33 @@
                     }
                     else
                     {
-                        floor.roomName = newName;
-                        floor.UpdateFloor();
-                        btn.Text = newName;
-                        btnDel.Tag = newName;
-                        row.Tag = newName;
+                        var waitPage = new Loading();
+                        MainPage.BaseView.AddChidren(waitPage);
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
+                                Application.RunOnMainThread(() =>
+                                {
+                                    if (editResult == DAL.Server.StateCode.SUCCESS)
+                                    {
+                                        floor.roomName = newName;
+                                        btn.Text = newName;
+                                    }
+                                });
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() => {
+                                    waitPage.Hide();
+                                    waitPage.RemoveFromParent();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
                     }
                 };
                 var floors = new List<string>();
@@ -50,28 +72,6 @@
             };
         }
 
-
-        /// <summary>
-        /// 鎴块棿缁戝畾妤煎眰锛屾ゼ灞傞�変腑浜嬩欢
-        /// </summary>
-        void LoadEvent_FloorChoose(Button btn)
-        {
-            btn.MouseUpEventHandler = (sender, e) => {
-                if (lastButton != null)
-                {
-                    lastButton.IsSelected = false;
-                    if (lastButton.Text == btn.Text)
-                    {
-                        lastButton = null;
-                    }
-                    //btn.IsBold = false;
-                }
-                btn.IsSelected = true;
-                //btn.IsBold = true;
-                lastButton = btn;
-            };
-        }
-
         /// <summary>
         /// 鍒犻櫎妤煎眰
         /// </summary>
@@ -81,30 +81,35 @@
             {
                 Action action = () =>
                 {
-                    refreshFloorList("del", btn.Tag.ToString());
+                    //璇ユゼ灞傚垹闄や箣鍚庯紝缁戝畾璇ユゼ灞傜殑鎴块棿瑕侀噸缃粦瀹氱殑妤煎眰
+                    foreach (var r in SpatialInfo.CurrentSpatial.RoomList)
+                    {
+                        if (r.parentId == btn.Tag.ToString())
+                        {
+                            r.parentId = "";
+                        }
+                    }
+                    SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
+                    for (int i = 0; i < floorsListView.ChildrenCount; i++)
+                    {
+                        if (floorsListView.GetChildren(i).GetType() == typeof(RowLayout))
+                        {
+                            RowLayout row = floorsListView.GetChildren(i) as RowLayout;
+                            if (row.Tag == null)
+                                continue;
+                            if (row.Tag.ToString() == btn.Tag.ToString())
+                            {
+                                row.RemoveFromParent();
+                                int count = SpatialInfo.CurrentSpatial.FloorList.Count > 8 ? 8 : SpatialInfo.CurrentSpatial.FloorList.Count;
+                                var contentViewHeight = (count + 1) * Application.GetRealHeight(50);
+                                contentView.Height = contentViewHeight;
+                                floorsListView.Height = count * Application.GetRealHeight(50);
+                            }
+                        }
+                    }
                 };
-                new PublicAssmebly().TipMsg(StringId.Tip, StringId.DelFloorTip, action);
+                new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DelFloorTip, action);
             };
         }
-
-        /// <summary>
-        /// 鎴块棿缁戝畾妤煎眰浜嬩欢
-        /// </summary>
-        void LoadEvent_BindFloor()
-        {
-            btnConfrim.MouseUpEventHandler = (sender, e) =>
-            {
-                if (lastButton == null)
-                {
-                    return;
-                }
-                room.parentId = lastButton.Tag.ToString();
-                room.parentId = lastButton.Tag.ToString();
-                backAction?.Invoke();
-                bodyView.RemoveFromParent();
-                //DB_ResidenceData.residenceData.SaveResidenceData();
-            };
-        }
-
     }
 }

--
Gitblit v1.8.0