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/FloorsManagementPage.cs | 201 ++++++++++++------------------------------------- 1 files changed, 51 insertions(+), 150 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs index 7e3efea..6da1bf5 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs @@ -21,56 +21,24 @@ /// </summary> Button btnFloorTitle; - - /// <summary> - /// 鎴块棿缁戝畾妤煎眰鐨勭‘瀹氭寜閽� - /// </summary> - Button btnConfrim; - /// <summary> - /// 褰撻〉闈㈡槸缂栬緫妤煎眰鏃讹紝璇ュ彉閲忎负绌� - /// 褰撻〉闈㈡槸缁欐埧闂寸粦瀹氭ゼ灞傛椂锛岃鍙橀噺涓嶄负绌� - /// </summary> - Room room; - /// <summary> - /// 鏍囬鏍忎慨鏀规ゼ灞備箣鍚庣殑鍥炶皟浜嬩欢 - /// </summary> - Action<string,string> refreshFloorList; - /// <summary> - /// 鍚庨��鍥炶皟浜嬩欢 - /// </summary> - Action backAction; - /// <summary> - /// 鏈�鍚庝竴娆$偣鍑荤殑鎸夐挳 - /// </summary> - Button lastButton; - public FloorsManagementPage() { bodyView = this; } /// <summary> - /// 浠庢埧闂磋繘鍏ユゼ灞備慨鏀圭晫闈紝闇�瑕佸洖璋冧簨浠舵洿鏂版埧闂寸殑妤煎眰淇℃伅 - /// </summary> - /// <param name="action"></param> - public FloorsManagementPage(Action action) - { - bodyView = this; - backAction = action; - } - /// <summary> /// 鍔犺浇鐣岄潰 /// </summary> - public void LoadPage(int titleId) + public void LoadPage() { - bodyView.RemoveAll(); bodyView.BackgroundColor = CSS_Color.BackgroundColor; - refreshFloorList = (type,floorName) => { - RefreshFloorsListView(type, floorName); + Action<string> addFloorAction = (floorName) => + { + RefreshFloorsListView(floorName); }; - new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView_AddIcon_BackAction("floors",refreshFloorList,backAction); + new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView_FloorTopView(addFloorAction, null); - int count = Floor.InsFloor.Floors.Count > 8 ? 8 : Floor.InsFloor.Floors.Count; + int count = SpatialInfo.CurrentSpatial.FloorList.Count > 8 ? 8 : SpatialInfo.CurrentSpatial.FloorList.Count; var contentViewHeight = (count + 1) * Application.GetRealHeight(50); contentView = new FrameLayout() @@ -86,8 +54,7 @@ }; bodyView.AddChidren(contentView); - - btnFloorTitle = new Button() + btnFloorTitle = new Button() { Height = Application.GetRealHeight(50), TextID = StringId.Floors, @@ -110,7 +77,7 @@ }; contentView.AddChidren(floorsListView); - foreach(var floor in Floor.InsFloor.Floors) + foreach (var floor in SpatialInfo.CurrentSpatial.FloorList) { LoadFloorRow(floor); } @@ -120,12 +87,12 @@ /// 鍔犺浇妤煎眰Row /// </summary> /// <param name="floor"></param> - void LoadFloorRow(Floor floor) + void LoadFloorRow(SpatialInfo floor) { var row = new RowLayout() { Height = Application.GetRealHeight(50), - Tag = floor.roomName, + Tag = floor.roomId, LineColor = CSS_Color.DividingLineColor, }; floorsListView.AddChidren(row); @@ -138,133 +105,67 @@ TextColor = CSS_Color.TextualColor, SelectedTextColor = CSS_Color.MainColor, Text = floor.roomName, - Tag = floor.uid, + Tag = floor.roomId, }; row.AddChidren(btnFloor); - if (room == null) + var btnDel = new Button() { - var btnDel = new Button() - { - TextID = StringId.Del, - BackgroundColor = CSS_Color.WarningColor, - TextColor = CSS_Color.MainBackgroundColor, - Tag = floor.roomName - }; - row.AddRightView(btnDel); - LoadEvent_DelFloor(btnDel); - LoadEvent_FloorNamgeChange(btnFloor, btnDel, row, floor); - } - else - { - LoadEvent_FloorChoose(btnFloor); - if (room.parentId == floor.uid) - { - lastButton = btnFloor; - btnFloor.IsSelected = true; - } - } + TextID = StringId.Del, + BackgroundColor = CSS_Color.WarningColor, + TextColor = CSS_Color.MainBackgroundColor, + Tag = floor.roomId + }; + row.AddRightView(btnDel); + LoadEvent_DelFloor(btnDel); + LoadEvent_FloorNamgeChange(btnFloor, floor); } - void RefreshFloorsListView(string changeType,string floorName) + void RefreshFloorsListView(string floorName) { - switch (changeType) + try { - case "add": + var waitPage = new Loading(); + MainPage.BaseView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + new System.Threading.Thread(() => + { try { - var f = new Floor() { roomName = floorName }; - Floor.InsFloor.AddFloor(f); - LoadFloorRow(f); - } - catch (Exception ex) - { - MainPage.Log("add floor eroor : " + ex.Message); - } - break; - case "edit": - for (int i = 0; i < floorsListView.ChildrenCount; i++) - { - if (floorsListView.GetChildren(i).GetType() == typeof(Button)) + var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.id }; + var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f); + if (addResult == DAL.Server.StateCode.SUCCESS) { - Button btn = floorsListView.GetChildren(i) as Button; - if (floorName == "") + Application.RunOnMainThread(() => { - btn.Text = floorName; - return; - } - if (btn.Tag.ToString() == floorName || btn.Tag.ToString() == floorName + "line") - { - btn.RemoveFromParent(); - } + LoadFloorRow(f); + int count2 = SpatialInfo.CurrentSpatial.FloorList.Count > 8 ? 8 : SpatialInfo.CurrentSpatial.FloorList.Count; + var contentViewHeight = (count2 + 1) * Application.GetRealHeight(50); + contentView.Height = contentViewHeight; + floorsListView.Height = count2 * Application.GetRealHeight(50); + + }); } } - break; - case "del": - //璇ユゼ灞傚垹闄や箣鍚庯紝缁戝畾璇ユゼ灞傜殑鎴块棿瑕侀噸缃粦瀹氱殑妤煎眰 - foreach (var r in DB_ResidenceData.Rooms) + catch { } + finally { - if (r.parentId == Floor.InsFloor.Floors.Find((obj) => obj.roomName == floorName).uid) - { - r.parentId = ""; - } + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); } - for (int i = 0; i < floorsListView.ChildrenCount; i++) - { - if (floorsListView.GetChildren(i).GetType() == typeof(Button)) - { - Button btn = floorsListView.GetChildren(i) as Button; - if (btn.Tag == null) - continue; - if (btn.Tag.ToString() == floorName + "line") - { - btn.RemoveFromParent(); - } - } - if (floorsListView.GetChildren(i).GetType() == typeof(RowLayout)) - { - RowLayout row = floorsListView.GetChildren(i) as RowLayout; - if (row.Tag == null) - continue; - if (row.Tag.ToString() == floorName) - { - row.RemoveFromParent(); - } - } - Floor.InsFloor.DelFloor(Floor.InsFloor.Floors.Find((obj) => obj.roomName == floorName)); - } - break; + }) + { IsBackground = true }.Start(); } - int count = Floor.InsFloor.Floors.Count > 10 ? 10 : Floor.InsFloor.Floors.Count; + 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)); } - /// <summary> - /// 鍒嗛厤缁檙oom妤煎眰鍏崇郴 - /// </summary> - public void LoadPage(Room r,int titleId) - { - room = r; - LoadPage(titleId); - - btnConfrim = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(582), - Width = Application.GetRealWidth(220), - Height = Application.GetRealWidth(44), - Radius = (uint)Application.GetRealWidth(22), - BackgroundColor = CSS_Color .MainColor, - TextColor = CSS_Color.MainBackgroundColor, - TextSize = CSS_FontSize.SubheadingFontSize, - TextAlignment = TextAlignment.Center, - IsBold = true, - TextID = StringId.Confirm, - }; - bodyView.AddChidren(btnConfrim); - - LoadEvent_BindFloor(); - } } } -- Gitblit v1.8.0