From 9d65c293924e4edbbc8c6c6091f55d7fc49c23eb Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 06 七月 2021 13:15:46 +0800
Subject: [PATCH] 乐橙子账号token
---
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 056ecd7..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()
{
- bodyView.RemoveAll();
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
- refreshFloorList = (type,floorName) => {
- RefreshFloorsListView(type, floorName);
+ Action<string> addFloorAction = (floorName) =>
+ {
+ RefreshFloorsListView(floorName);
};
- new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",refreshFloorList,backAction);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView_FloorTopView(addFloorAction, null);
- int count = DB_ResidenceData.residenceData.floors.Count > 8 ? 8 : DB_ResidenceData.residenceData.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 DB_ResidenceData.residenceData.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.name,
+ Tag = floor.roomId,
LineColor = CSS_Color.DividingLineColor,
};
floorsListView.AddChidren(row);
@@ -137,134 +104,68 @@
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.TextualColor,
SelectedTextColor = CSS_Color.MainColor,
- Text = floor.name,
- Tag = floor.sid,
+ Text = floor.roomName,
+ 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.name
- };
- row.AddRightView(btnDel);
- LoadEvent_DelFloor(btnDel);
- LoadEvent_FloorNamgeChange(btnFloor,btnDel,row,floor);
- }
- else {
- LoadEvent_FloorChoose(btnFloor);
- if (room.floorId == floor.sid)
- {
- 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() { sid = Guid.NewGuid().ToString(), name = floorName };
- DB_ResidenceData.residenceData.floors.Add(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.floorId == DB_ResidenceData.residenceData.floors.Find((obj) => obj.name == floorName).sid)
- {
- r.floorId = "";
- }
+ 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();
- }
- }
- DB_ResidenceData.residenceData.floors.Remove(DB_ResidenceData.residenceData.floors.Find((obj) => obj.name == floorName));
- }
- break;
+ })
+ { IsBackground = true }.Start();
}
- DB_ResidenceData.residenceData.SaveResidenceData();
- int count = DB_ResidenceData.residenceData.floors.Count > 10 ? 10 : DB_ResidenceData.residenceData.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)
- {
- room = r;
- LoadPage();
-
- btnConfrim = new Button()
- {
- Gravity = Gravity.CenterHorizontal,
- Y = Application.GetRealHeight(582),
- Width = Application.GetRealWidth(220),
- Height = Application.GetRealHeight(44),
- Radius = (uint)Application.GetRealHeight(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