From f6fd8acd7c53c44187e70b4709443318a628f4b5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 16 六月 2020 13:12:33 +0800 Subject: [PATCH] 2020-06-016 --- HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs | 56 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 31 insertions(+), 25 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..01377dc 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,11 +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 PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.FloorsManagement),"floors",topCallBcak); + new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",refreshFloorList,backAction); int count = DB_ResidenceData.residenceData.floors.Count > 8 ? 8 : DB_ResidenceData.residenceData.floors.Count; var contentViewHeight = (count + 1) * Application.GetRealHeight(50); @@ -89,6 +92,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() { @@ -107,20 +116,13 @@ /// 鍔犺浇妤煎眰Row /// </summary> /// <param name="floor"></param> - void LoadFloorRow(string floor) + void LoadFloorRow(Floor 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); @@ -131,13 +133,12 @@ TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.TextualColor, SelectedTextColor = CSS_Color.MainColor, - Text = floor, + Text = floor.name, }; row.AddChidren(btnFloor); if (room == null) { - LoadEvent_FloorNamgeChange(floor, btnFloor); var btnDel = new Button() { @@ -148,23 +149,23 @@ }; row.AddRightView(btnDel); LoadEvent_DelFloor(btnDel); + LoadEvent_FloorNamgeChange(btnFloor,btnDel,row,floor); } 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 { - LoadFloorRow(floorName); + var f = new Floor() { sid = Guid.NewGuid().ToString(), name = floorName }; + DB_ResidenceData.residenceData.floors.Add(f); + LoadFloorRow(f); } catch (Exception ex) { @@ -195,9 +196,9 @@ //璇ユゼ灞傚垹闄や箣鍚庯紝缁戝畾璇ユゼ灞傜殑鎴块棿瑕侀噸缃粦瀹氱殑妤煎眰 foreach (var r in DB_ResidenceData.residenceData.rooms) { - if (r.floorIndex == DB_ResidenceData.residenceData.floors.IndexOf(floorName)) + if (r.floorId == DB_ResidenceData.residenceData.floors.Find((obj)=>obj.name == floorName).sid) { - r.floorIndex = -1; + r.floorId = ""; } } if (floorsListView.GetChildren(i).GetType() == typeof(Button)) @@ -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(DB_ResidenceData.residenceData.floors.Find((obj) => obj.name == 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