From 7167334c0e89dd84827d59e726123d14776e3a09 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 16 六月 2020 11:14:13 +0800
Subject: [PATCH] 2020-06-16-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs |   59 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 39 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 45a73c5..ce9d6e9 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
@@ -31,12 +31,28 @@
         /// 褰撻〉闈㈡槸缁欐埧闂寸粦瀹氭ゼ灞傛椂锛岃鍙橀噺涓嶄负绌�
         /// </summary>
         Room room;
-
-        Action<string,string> topCallBcak;
+        /// <summary>
+        /// 鏍囬鏍忎慨鏀规ゼ灞備箣鍚庣殑鍥炶皟浜嬩欢
+        /// </summary>
+        Action<string,string> refreshFloorList;
+        /// <summary>
+        /// 鍚庨��鍥炶皟浜嬩欢
+        /// </summary>
+        Action backAction;
 
         public FloorsManagementPage()
         {
             bodyView = this;
+        }
+
+        /// <summary>
+        /// 浠庢埧闂磋繘鍏ユゼ灞備慨鏀圭晫闈紝闇�瑕佸洖璋冧簨浠舵洿鏂版埧闂寸殑妤煎眰淇℃伅
+        /// </summary>
+        /// <param name="action"></param>
+        public FloorsManagementPage(Action action)
+        {
+            bodyView = this;
+            backAction = action;
         }
         /// <summary>
         /// 鍔犺浇鐣岄潰
@@ -45,10 +61,11 @@
         {
             bodyView.RemoveAll();
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
-            topCallBcak = (type,floor) => {
-                ChangeFloorsListView(type, floor);
+            refreshFloorList = (type,floor) => {
+                RefreshFloorsListView(type, floor);
             };
-            new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.FloorsManagement),"floors",topCallBcak);
+            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;
             var contentViewHeight = (count + 1) * Application.GetRealHeight(50);
@@ -76,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()
             {
@@ -96,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);
 
@@ -124,7 +140,6 @@
 
             if (room == null)
             {
-                LoadEvent_FloorNamgeChange(floor, btnFloor);
 
                 var btnDel = new Button()
                 {
@@ -135,22 +150,21 @@
                 };
                 row.AddRightView(btnDel);
                 LoadEvent_DelFloor(btnDel);
+                LoadEvent_FloorNamgeChange(btnFloor,btnDel,row);
             }
             else {
                 LoadEvent_FloorChoose(btnFloor);
             }
         }
 
-        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)
@@ -202,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