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/RoomEditFunctionPage.cs | 327 +++++++++++++++++++++++++++---------------------------
1 files changed, 165 insertions(+), 162 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPage.cs
index db68f7b..3293e0d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPage.cs
@@ -56,14 +56,27 @@
/// 琚慨鏀规暟鎹殑鍔熻兘鍒楄〃锛屽湪闇�瑕佷繚瀛樼殑鏃跺�欏啀淇濆瓨鏁版嵁
/// </summary>
List<Function> changeList = new List<Function>();
+ /// <summary>
+ /// 鏂板鐨勬埧闂寸粦瀹氬姛鑳戒簨浠讹紝鐢ㄦ埛纭畾鐢熸垚鎴块棿涔嬪悗锛屽啀灏嗗姛鑳界粦瀹氬埌鎴块棿
+ /// </summary>
+ Action<List<Function>> newRoomAddFunction;
#endregion
-
+ /// <summary>
+ /// 缂栬緫鐜版湁鎴块棿鐨勬瀯閫犲嚱鏁�
+ /// </summary>
+ /// <param name="r"></param>
public RoomEditFunctionPage(Room r)
{
bodyView = this;
room = r;
}
+ public RoomEditFunctionPage(Room r, Action<List<Function>> action)
+ {
+ bodyView = this;
+ room = r;
+ newRoomAddFunction = action;
+ }
/// <summary>
/// 鍔犺浇鐣岄潰
/// </summary>
@@ -71,7 +84,6 @@
{
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView();
- //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.AddFunction));
#region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩�
showdFunctionTypeRow = new FrameLayout()
@@ -95,6 +107,10 @@
IsBold = true
};
showdFunctionTypeRow.AddChidren(btnUnallocated);
+ if(Language.CurrentLanguage != "Chinese")
+ {
+ btnUnallocated.Width = Application.GetRealWidth(130);
+ }
btnAllocated = new Button()
{
@@ -141,13 +157,18 @@
Y = showdFunctionTypeRow.Bottom,
Height = Application.GetRealHeight(518 - 40 - 62),
BackgroundColor = CSS_Color.BackgroundColor,
+
};
bodyView.AddChidren(functionListView);
- foreach (var function in DB_ResidenceData.functionList.GetAllFunction())
+ foreach (var function in FunctionList.List.GetDeviceFunctionList())
{
- function.roomIdList.Remove(null);
- if (function.roomIdList.Count > 0 )
+ function.roomIds.Remove(null);
+ if(MainPage.RoomNotSupportFunctionList.Contains(function.spk))
+ {
+ continue;
+ }
+ if (function.roomIds.Count > 0 )
{
allocatedList.Add(function);
}
@@ -159,20 +180,29 @@
LoadFunctionListRow(unallocatedList);
+ var bottomView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(591),
+ Height = Application.GetRealHeight(76) + Application.GetRealWidth(44),
+ Radius = (uint)Application.GetRealWidth(22),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ };
+ bodyView.AddChidren(bottomView);
+
btnConfrim = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = Application.GetRealHeight(582),
+ Y = Application.GetRealHeight(603),
Width = Application.GetRealWidth(220),
- Height = Application.GetRealHeight(44),
- Radius = (uint)Application.GetRealHeight(22),
+ 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,
+ TextID = StringId.ConfirmAdd,
};
bodyView.AddChidren(btnConfrim);
@@ -188,15 +218,24 @@
showdFunctionCount = 0;
functionListView.RemoveAll();
+ bool isFrist = true;
+
foreach (var function in functions)
{
- functionListView.AddChidren(new Button()
+ if (isFrist)
{
- Gravity = Gravity.CenterHorizontal,
- Width = Application.GetRealWidth(343),
- Height = Application.GetRealWidth(1),
- BackgroundColor = CSS_Color.DividingLineColor,
- });
+ isFrist = false;
+ }
+ else
+ {
+ functionListView.AddChidren(new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealWidth(1),
+ BackgroundColor = CSS_Color.DividingLineColor,
+ });
+ }
FrameLayout functionRow = new FrameLayout()
{
@@ -213,71 +252,9 @@
Height = Application.GetMinRealAverage(28),
};
functionRow.AddChidren(btnFunctionIcon);
- switch (function.functionCategory)
- {
- case FunctionCategory.Thermostat:
- switch (function.functionType)
- {
- case FunctionType.AC:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png";
- break;
- case FunctionType.FloorHeating:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
- break;
- }
- break;
- case FunctionCategory.Curtain:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png";
- break;
- case FunctionCategory.Light:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png";
- break;
- case FunctionCategory.SwitchDevice:
- switch (function.functionType)
- {
- case FunctionType.Socket:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketThinIcon.png";
- break;
- }
- break;
- case FunctionCategory.Electrical:
- switch (function.functionType)
- {
- case FunctionType.Fan:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanThinIcon.png";
- break;
- case FunctionType.TV:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVThinIcon.png";
- break;
- }
- break;
- case FunctionCategory.Scene:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
- break;
- case FunctionCategory.Music:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png";
- break;
- case FunctionCategory.Sensor:
- switch(function.functionType)
- {
- case FunctionType.PM25:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/FunctionIconPm25.png";
- break;
- case FunctionType.CO2:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/FunctionIconCO2.png";
- break;
- case FunctionType.TVOC:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/FunctionIconTVOC.png";
- break;
- case FunctionType.Humidity:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/FunctionIconHumidity.png";
- break;
- case FunctionType.Temp:
- btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/FunctionIconTemp.png";
- break;
- }
- break;
- }
+
+ btnFunctionIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png";
+
if (!btnAllocated.IsSelected)
{
@@ -328,7 +305,7 @@
Height = Application.GetRealWidth(28),
UnSelectedImagePath = "Public/ChooseIcon.png",
SelectedImagePath = "Public/ChooseOnIcon.png",
- IsSelected = function.roomIdList.Contains(room.sid)
+ IsSelected = function.roomIds.Contains(room.roomId)
};
functionRow.AddChidren(btnChooseIcon);
LoadEvent_ChangeRoomFunctionList(functionRow, btnChooseIcon, function);
@@ -350,91 +327,117 @@
/// </summary>
void LoadPage_LoadChooseRoomDialog()
{
- Dialog dialog = new Dialog();
- FrameLayout dialogBodyView = new FrameLayout()
- {
- BackgroundColor = CSS_Color.DialogTransparentColor1,
- };
- dialog.AddChidren(dialogBodyView);
-
- FrameLayout contentView;
- contentView = new FrameLayout()
- {
- X = Application.GetRealWidth(205),
- Y = Application.GetRealHeight(106),
- Width = Application.GetRealWidth(160),
- Height = Application.GetRealHeight(200),
- BackgroundImagePath = "Public/ChooseRoomListbg.png",
- };
- dialogBodyView.AddChidren(contentView);
-
- VerticalScrolViewLayout roomListView;
- roomListView = new VerticalScrolViewLayout()
- {
- X = Application.GetRealWidth(8),
- Y = Application.GetRealHeight(15),
- Width = Application.GetRealWidth(160),
- Height = Application.GetRealHeight(45 * 4),
- };
- contentView.AddChidren(roomListView);
-
- Button btnAllRoom;
- btnAllRoom = new Button()
- {
- X = Application.GetRealWidth(16),
- Width = Application.GetRealWidth(128),
- Height = Application.GetRealHeight(50),
- TextID = StringId.All,
- TextColor = CSS_Color.FirstLevelTitleColor,
- SelectedTextColor = CSS_Color.MainColor,
- TextSize = CSS_FontSize.SubheadingFontSize,
- IsSelected = showedFunctionRoomId == "0",
- TextAlignment = TextAlignment.CenterLeft,
- Tag = "0"
- };
- roomListView.AddChidren(btnAllRoom);
- LoadEvent_ChangeShowedFunctionList(btnAllRoom, dialog, Language.StringByID(StringId.All));
-
- roomListView.AddChidren(new Button()
- {
- Gravity = Gravity.CenterHorizontal,
- Width = Application.GetRealWidth(112),
- Height = Application.GetRealWidth(1),
- BackgroundColor = CSS_Color.DividingLineColor,
- });
- foreach (var tempRoom in DB_ResidenceData.rooms)
- {
-
- Button btnRoom = new Button()
+ Action<string, string> action = (key, value) => {
+ if (lastButton != null)
{
- X = Application.GetRealWidth(16),
- Width = Application.GetRealWidth(128),
- Height = Application.GetRealHeight(50),
- Text = tempRoom.name,
- TextColor = CSS_Color.FirstLevelTitleColor,
- SelectedTextColor = CSS_Color.MainColor,
- TextSize = CSS_FontSize.SubheadingFontSize,
- TextAlignment = TextAlignment.CenterLeft,
- IsSelected = showedFunctionRoomId == tempRoom.sid,
- Tag = tempRoom.sid,
- };
- roomListView.AddChidren(btnRoom);
- LoadEvent_ChangeShowedFunctionList(btnRoom, dialog, tempRoom.name);
-
- roomListView.AddChidren(new Button()
+ lastButton.IsSelected = false;
+ }
+ showedFunctionRoomId = key;
+ if (showedFunctionRoomId == "0")
{
- Gravity = Gravity.CenterHorizontal,
- Width = Application.GetRealWidth(112),
- Height = Application.GetRealWidth(1),
- BackgroundColor = CSS_Color.DividingLineColor,
- });
+ LoadFunctionListRow(allocatedList);
+ }
+ else
+ {
+ LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIds.Contains(showedFunctionRoomId)));
+ }
+ btnChoosedRoom.Text = value;
+ };
+
+ Dictionary<string, string> items = new Dictionary<string, string>();
+ items.Add("0",Language.StringByID(StringId.All));
+ foreach(var room in SpatialInfo.CurrentSpatial.RoomList)
+ {
+ items.Add(room.roomId,room.roomName);
}
- dialogBodyView.MouseUpEventHandler = (sender, e) =>
- {
- dialog.Close();
- };
+ var chooseDialog = new ListCellDialog(items,showedFunctionRoomId,action);
+ chooseDialog.ShowRightDialog();
- dialog.Show();
+ //Dialog dialog = new Dialog();
+ //FrameLayout dialogBodyView = new FrameLayout()
+ //{
+ // BackgroundColor = CSS_Color.DialogTransparentColor1,
+ //};
+ //dialog.AddChidren(dialogBodyView);
+
+ //FrameLayout contentView;
+ //contentView = new FrameLayout()
+ //{
+ // X = Application.GetRealWidth(205),
+ // Y = Application.GetRealHeight(106),
+ // Width = Application.GetRealWidth(160),
+ // Height = Application.GetRealHeight(200),
+ // BackgroundImagePath = "Public/ChooseRoomListbg.png",
+ //};
+ //dialogBodyView.AddChidren(contentView);
+
+ //VerticalScrolViewLayout roomListView;
+ //roomListView = new VerticalScrolViewLayout()
+ //{
+ // X = Application.GetRealWidth(8),
+ // Y = Application.GetRealHeight(15),
+ // Width = Application.GetRealWidth(160),
+ // Height = Application.GetRealHeight(45 * 4),
+ //};
+ //contentView.AddChidren(roomListView);
+
+ //Button btnAllRoom;
+ //btnAllRoom = new Button()
+ //{
+ // X = Application.GetRealWidth(16),
+ // Width = Application.GetRealWidth(128),
+ // Height = Application.GetRealHeight(50),
+ // TextID = StringId.All,
+ // TextColor = CSS_Color.FirstLevelTitleColor,
+ // SelectedTextColor = CSS_Color.MainColor,
+ // TextSize = CSS_FontSize.SubheadingFontSize,
+ // IsSelected = showedFunctionRoomId == "0",
+ // TextAlignment = TextAlignment.CenterLeft,
+ // Tag = "0"
+ //};
+ //roomListView.AddChidren(btnAllRoom);
+ //LoadEvent_ChangeShowedFunctionList(btnAllRoom, dialog, Language.StringByID(StringId.All));
+
+ //roomListView.AddChidren(new Button()
+ //{
+ // Gravity = Gravity.CenterHorizontal,
+ // Width = Application.GetRealWidth(112),
+ // Height = Application.GetRealWidth(1),
+ // BackgroundColor = CSS_Color.DividingLineColor,
+ //});
+ //foreach (var tempRoom in SpatialInfo.CurrentSpatial.RoomList)
+ //{
+
+ // Button btnRoom = new Button()
+ // {
+ // X = Application.GetRealWidth(16),
+ // Width = Application.GetRealWidth(128),
+ // Height = Application.GetRealHeight(50),
+ // Text = tempRoom.roomName,
+ // TextColor = CSS_Color.FirstLevelTitleColor,
+ // SelectedTextColor = CSS_Color.MainColor,
+ // TextSize = CSS_FontSize.SubheadingFontSize,
+ // TextAlignment = TextAlignment.CenterLeft,
+ // IsSelected = showedFunctionRoomId == tempRoom.roomId,
+ // Tag = tempRoom.roomId,
+ // };
+ // roomListView.AddChidren(btnRoom);
+ // LoadEvent_ChangeShowedFunctionList(btnRoom, dialog, tempRoom.roomName);
+
+ // roomListView.AddChidren(new Button()
+ // {
+ // Gravity = Gravity.CenterHorizontal,
+ // Width = Application.GetRealWidth(112),
+ // Height = Application.GetRealWidth(1),
+ // BackgroundColor = CSS_Color.DividingLineColor,
+ // });
+ //}
+ //dialogBodyView.MouseUpEventHandler = (sender, e) =>
+ //{
+ // dialog.Close();
+ //};
+
+ //dialog.Show();
}
--
Gitblit v1.8.0