From 06696e6f225733a60b03eea4a7c6374053d92c1d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 14 四月 2020 14:15:35 +0800
Subject: [PATCH] 20200414

---
 HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs |   46 ++++++++++++++++++++++++++--------------------
 1 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
index 9d63a67..8a7cca1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
@@ -34,7 +34,7 @@
         /// <summary>
         /// 鏍囬鏍忎慨鏀规ゼ灞備箣鍚庣殑鍥炶皟浜嬩欢
         /// </summary>
-        Action<string,string> topCallBack;
+        Action<string,string> refreshFloorList;
         /// <summary>
         /// 鍚庨��鍥炶皟浜嬩欢
         /// </summary>
@@ -45,6 +45,10 @@
             bodyView = this;
         }
 
+        /// <summary>
+        /// 浠庢埧闂磋繘鍏ユゼ灞備慨鏀圭晫闈紝闇�瑕佸洖璋冧簨浠舵洿鏂版埧闂寸殑妤煎眰淇℃伅
+        /// </summary>
+        /// <param name="action"></param>
         public FloorsManagementPage(Action action)
         {
             bodyView = this;
@@ -57,10 +61,10 @@
         {
             bodyView.RemoveAll();
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
-            topCallBack = (type,floor) => {
-                ChangeFloorsListView(type, floor);
+            refreshFloorList = (type,floor) => {
+                RefreshFloorsListView(type, floor);
             };
-            new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",topCallBack,backAction);
+            new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",refreshFloorList,backAction);
             //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.FloorsManagement),"floors",topCallBcak);
 
             int count = DB_ResidenceData.residenceData.floors.Count > 8 ? 8 : DB_ResidenceData.residenceData.floors.Count;
@@ -89,6 +93,12 @@
                 TextColor = CSS_Color.FirstLevelTitleColor,
             };
             contentView.AddChidren(btnFloorTitle);
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(1),
+                Y = Application.GetRealHeight(49),
+                BackgroundColor = CSS_Color.DividingLineColor,
+            });
 
             floorsListView = new VerticalScrolViewLayout()
             {
@@ -109,18 +119,11 @@
         /// <param name="floor"></param>
         void LoadFloorRow(string floor)
         {
-            floorsListView.AddChidren(
-                  new Button()
-                  {
-                      Height = Application.GetRealHeight(1),
-                      BackgroundColor = CSS_Color.DividingLineColor,
-                      Tag = floor + "line"
-                  });
-
             var row = new RowLayout()
             {
                 Height = Application.GetRealHeight(50),
-                Tag = floor
+                Tag = floor,
+                LineColor = CSS_Color.DividingLineColor,
             };
             floorsListView.AddChidren(row);
 
@@ -137,14 +140,14 @@
 
             if (room == null)
             {
-                LoadEvent_FloorNamgeChange(floor, btnFloor);
+                LoadEvent_FloorNamgeChange(btnFloor);
 
                 var btnDel = new Button()
                 {
                     TextID = StringId.Del,
                     BackgroundColor = CSS_Color.WarningColor,
                     TextColor = CSS_Color.MainBackgroundColor,
-                    Tag = floor
+                    Tag = DB_ResidenceData.residenceData.floors.IndexOf(floor)
                 };
                 row.AddRightView(btnDel);
                 LoadEvent_DelFloor(btnDel);
@@ -154,16 +157,14 @@
             }
         }
 
-        void ChangeFloorsListView(string changeType,string floorName)
+        void RefreshFloorsListView(string changeType,string floorName)
         {
-            int count = DB_ResidenceData.residenceData.floors.Count > 10 ? 10 : DB_ResidenceData.residenceData.floors.Count;
-            floorsListView.Height = Application.GetRealHeight(50 * count);
-            contentView.Height = Application.GetRealHeight(50 * (count + 1));
             switch (changeType)
             {
                 case "add":
                     try
                     {
+                        DB_ResidenceData.residenceData.floors.Add(floorName);
                         LoadFloorRow(floorName);
                     }
                     catch (Exception ex)
@@ -215,14 +216,19 @@
                             RowLayout row = floorsListView.GetChildren(i) as RowLayout;
                             if (row.Tag == null)
                                 continue;
-                            if (row.Tag.ToString() == floorName )
+                            if (row.Tag.ToString() == floorName)
                             {
                                 row.RemoveFromParent();
                             }
                         }
+                        DB_ResidenceData.residenceData.floors.Remove(floorName);
                     }
                     break;
             }
+            DB_ResidenceData.residenceData.SaveResidenceData();
+            int count = DB_ResidenceData.residenceData.floors.Count > 10 ? 10 : DB_ResidenceData.residenceData.floors.Count;
+            floorsListView.Height = Application.GetRealHeight(50 * count);
+            contentView.Height = Application.GetRealHeight(50 * (count + 1));
         }
 
         /// <summary>

--
Gitblit v1.8.0