From 7d005a7618e3d7a80d8ede3baf6ecc4bf8019cd5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 01 九月 2020 15:22:09 +0800 Subject: [PATCH] 2020-09-01 --- HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs | 118 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 86 insertions(+), 32 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs index 2753df0..6e11318 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using System.Collections.Generic; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -43,15 +44,20 @@ #endregion #region 鍖哄煙鍙橀噺 + /// <summary> + /// 闇�瑕佹樉绀虹殑鍔熻兘鎬绘暟锛屽奖鍝嶅埌鐣岄潰鏄剧ず + /// </summary> int showdFunctionCount = 0; - string roomId; + Room room; string showedFunctionRoomId = "0"; + List<Function> unallocatedList = new List<Function>(); + List<Function> allocatedList = new List<Function>(); #endregion - public RoomEditFunctionPage(string rId) + public RoomEditFunctionPage(Room r) { bodyView = this; - roomId = rId; + room = r; } /// <summary> @@ -130,11 +136,24 @@ { Y = showdFunctionTypeRow.Bottom, Height = Application.GetRealHeight(518 - 40 - 62), - BackgroundColor = CSS_Color.MainBackgroundColor, + BackgroundColor = CSS_Color.BackgroundColor, }; bodyView.AddChidren(functionListView); - LoadFunctionListRow(true); + foreach (var function in DB_ResidenceData.functionList.GetAllFunction()) + { + function.roomIdList.Remove(null); + if (function.roomIdList.Count > 0 ) + { + allocatedList.Add(function); + } + else + { + unallocatedList.Add(function); + } + } + + LoadFunctionListRow(unallocatedList); btnConfrim = new Button() @@ -161,24 +180,13 @@ /// 鏄剧ず鍔熻兘Row /// </summary> /// <param name="showUnallocated">鏄惁鏄樉绀烘湭鍒嗛厤</param> - void LoadFunctionListRow(bool showUnallocated) + void LoadFunctionListRow(List<Function> functions) { showdFunctionCount = 0; functionListView.RemoveAll(); - foreach (var function in DB_ResidenceData.residenceData.functionList.functions) + foreach (var function in functions) { - if (function.roomIdList.Count > 0 && !function.roomIdList.Contains(roomId) && showUnallocated) - { - continue; - } - if (!showUnallocated && showedFunctionRoomId != null)//濡傛灉闇�瑕佹樉绀哄凡缁忓垎閰嶇殑鍔熻兘锛屽苟涓旀寚瀹氭樉绀哄垎鍒扮殑鎴块棿 - { - if (!function.roomIdList.Contains(showedFunctionRoomId))//濡傛灉褰撳墠鍔熻兘涓嶆槸闇�瑕佹樉绀虹殑 - { - continue; - } - } functionListView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, @@ -208,7 +216,7 @@ switch (function.functionType) { case FunctionType.AC: - btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon.png"; + btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; break; case FunctionType.FloorHeating: btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; @@ -221,13 +229,58 @@ 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; } - if (showUnallocated) + if (!btnAllocated.IsSelected) { var btnFunctionName = new Button() { - X = btnFunctionIcon.Right + Application.GetRealWidth(3), + X = btnFunctionIcon.Right + Application.GetRealWidth(12), Width = Application.GetRealWidth(200), Text = function.name, TextAlignment = TextAlignment.CenterLeft, @@ -240,9 +293,9 @@ { var btnFunctionName = new Button() { - X = btnFunctionIcon.Right + Application.GetRealWidth(3), + X = btnFunctionIcon.Right + Application.GetRealWidth(12), Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(30), + Height = Application.GetRealHeight(40), Text = function.name, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, @@ -252,8 +305,8 @@ var btnFunctionFloorName = new Button() { - X = btnFunctionIcon.Right + Application.GetRealWidth(3), - Y = btnFunctionName.Bottom, + X = btnFunctionIcon.Right + Application.GetRealWidth(12), + Y = Application.GetRealHeight(50), Width = Application.GetRealWidth(200), Height = Application.GetRealHeight(20), Text = function.GetRoomListName(), @@ -262,7 +315,6 @@ TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, }; functionRow.AddChidren(btnFunctionFloorName); - } Button btnChooseIcon = new Button() @@ -271,9 +323,9 @@ X = Application.GetRealWidth(335), Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - SelectedImagePath = "Public/SelectionIcon.png", - UnSelectedImagePath = "Public/UnSelectionIcon.png", - IsSelected = function.roomIdList.Contains(roomId) + UnSelectedImagePath = "Public/ChooseIcon.png", + SelectedImagePath = "Public/ChooseOnIcon.png", + IsSelected = function.roomIdList.Contains(room.sid) }; functionRow.AddChidren(btnChooseIcon); LoadEvent_ChangeRoomFunctionList(functionRow, btnChooseIcon, function); @@ -284,12 +336,14 @@ if (showdFunctionCount < 9) { functionListView.Height = Application.GetRealHeight(51 * showdFunctionCount); + }else + { + functionListView.Height = Application.GetRealHeight(518 - 40 - 62); } - } /// <summary> - /// 鏄剧ず鎴块棿閫変腑寮圭獥 + /// 鏄剧ず鎴块棿閫夐�夋嫨寮圭獥 /// </summary> void LoadPage_LoadChooseRoomDialog() { @@ -345,7 +399,7 @@ Height = Application.GetRealWidth(1), BackgroundColor = CSS_Color.DividingLineColor, }); - foreach (var tempRoom in DB_ResidenceData.residenceData.rooms) + foreach (var tempRoom in DB_ResidenceData.rooms) { Button btnRoom = new Button() -- Gitblit v1.8.0