From 611786df5108dca0bdcff03834cc285cba4b8e61 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 13 十月 2020 16:48:43 +0800 Subject: [PATCH] 2020-10-13-1 --- HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 220 +++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 157 insertions(+), 63 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 1a064c6..8e96290 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -64,9 +64,14 @@ #endregion + + List<Room> roomsShowed; + public ClassificationPage() { bodyView = this; + roomsShowed = new List<Room>(); + roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms); } public void LoadPage() @@ -112,7 +117,7 @@ contentPageView = new PageLayout() { Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 64-49+20), + Height = Application.GetRealHeight(667 - 64-49+30), BackgroundColor = CSS_Color.MainBackgroundColor, IsShowPoint = false }; @@ -172,7 +177,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextAlignment = TextAlignment.CenterLeft, - Text = UserConfig.Instance.CurFoor, + Text = OnAppConfig.Instance.CurFoor, }; roomFloorChangeView.AddChidren(btnFloor); /// <summary> @@ -190,7 +195,6 @@ roomFloorChangeView.AddChidren(btnSwitchDipaly); #endregion - /// <summary> /// 鎴块棿鍒楄〃鍖哄煙 /// </summary> @@ -198,32 +202,47 @@ { Y = roomFloorChangeView.Bottom, Height = Application.GetRealHeight(497 + 10 + 30), - BackgroundColor = CSS_Color.MainBackgroundColor, + //BackgroundColor = CSS_Color.MainBackgroundColor, }; roomPageView.AddChidren(roomListView); + LoadRoomRows(); + roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//澶珮瑙嗗浘锛屽皢瀵艰埅浜嗛伄鎸$殑閮ㄥ垎瀹屾暣鏄剧ず + #endregion - foreach (var room in DB_ResidenceData.residenceData.rooms) + LoadDialog_ChangeFloor(); + } + + /// <summary> + /// 鍔犺浇鎴块棿鍒楄〃鍖哄煙 + /// </summary> + void LoadRoomRows () + { + roomListView.RemoveAll(); + foreach (var room in roomsShowed) { var roomView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(184), - Radius = (uint)Application.GetRealHeight(12), - BorderColor = 0x00000000, - BorderWidth = 1, + Radius = (uint)Application.GetRealWidth(12), + BackgroundColor = 0xFFFF0000, Tag = room.sid, }; roomListView.AddChidren(roomView); - var roomViewbg = new Button() + var roomViewbg = new ImageView() { - UnSelectedImagePath = room.backgroundImage, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(184), + ImagePath = room.backgroundImage, + Radius = (uint)Application.GetRealWidth(12), }; roomView.AddChidren(roomViewbg); var roomViewbgColor = new Button() { + Radius = (uint)Application.GetRealWidth(12), BackgroundColor = 0x19333333, }; roomView.AddChidren(roomViewbgColor); @@ -256,7 +275,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/TempIcon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png", }; environmentalView.AddChidren(btnTempIcon); @@ -279,7 +298,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/HumidityIcon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png", }; environmentalView.AddChidren(btnHumidityIcon); @@ -302,7 +321,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/InfoIcon/Pm25Icon.png", + UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png", }; environmentalView.AddChidren(btnPm25Icon); @@ -328,10 +347,10 @@ Width = Application.GetMinRealAverage(58), Height = Application.GetMinRealAverage(58), UnSelectedImagePath = "Classification/Room/AllCloseIcon.png", - Tag = "AllClose" + Tag = "AllClose", + Visible = false }; roomView.AddChidren(btnAllClose); - LoadEvent_CloseAllFunction(btnAllClose, room); var btn = new Button() @@ -348,11 +367,6 @@ }; } - - roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//澶珮瑙嗗浘锛屽皢瀵艰埅浜嗛伄鎸$殑閮ㄥ垎瀹屾暣鏄剧ず - #endregion - - LoadDialog_ChangeFloor(); } /// <summary> @@ -406,7 +420,7 @@ FrameLayout functionView = new FrameLayout() { Height = Application.GetRealWidth(161), - Radius = (uint)Application.GetRealHeight(6), + Radius = (uint)Application.GetRealWidth(6), BackgroundColor = CSS_Color.MainBackgroundColor, Tag = item + "_View", Y = index % 2 == 1 ? lastY2 : lastY1 @@ -459,7 +473,7 @@ int functionOnCount = 0; switch (item) { - case FunctionCategory.Light: + case ShowFunction.Light: #region Light btnName.TextID = StringId.Lights; functionCount = DB_ResidenceData.residenceData.functionList.lights.Count; @@ -472,6 +486,7 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnLightPower); btnLightPower.MouseUpEventHandler = (sender, e) => { @@ -485,7 +500,7 @@ }; #endregion break; - case FunctionCategory.AC: + case ShowFunction.AC: #region AC btnName.TextID = StringId.AC; functionCount = DB_ResidenceData.residenceData.functionList.aCs.Count; @@ -498,6 +513,7 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnAcPower); btnAcPower.MouseUpEventHandler = (sender, e) => { @@ -511,7 +527,7 @@ }; #endregion break; - case FunctionCategory.Curtain: + case ShowFunction.Curtain: #region Curtain btnName.TextID = StringId.Curtain; functionCount = DB_ResidenceData.residenceData.functionList.curtains.Count; @@ -525,6 +541,7 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", + IsSelected = functionCount == functionOnCount }; functionView.AddChidren(btnClose); @@ -549,68 +566,128 @@ }; #endregion break; - case FunctionCategory.FloorHeating: + case ShowFunction.FloorHeating: + #region 鍦扮儹 btnName.TextID = StringId.FloorHeating; + functionCount = DB_ResidenceData.residenceData.functionList.floorHeatings.Count; + functionOnCount = DB_ResidenceData.residenceData.functionList.floorHeatings.FindAll((obj) => obj.on_off == "on").Count; + Button btnFhPower = new Button() + { + X = Application.GetRealWidth(120), + Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + SelectedImagePath = "Public/PowerOpen.png", + UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount + }; + functionView.AddChidren(btnFhPower); + btnFhPower.MouseUpEventHandler = (sender, e) => { + LoadEvent_SwitchFunction(btnFhPower, item); + }; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(StringId.FloorHeating); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.DoorLock: + case ShowFunction.DoorLock: btnName.TextID = StringId.DoorLock; break; - case FunctionCategory.Electric: + case ShowFunction.Electric: + #region 鐢靛櫒 btnName.TextID = StringId.Electric; + functionCount = DB_ResidenceData.residenceData.functionList.electricals.Count; + functionOnCount = DB_ResidenceData.residenceData.functionList.electricals.FindAll((obj) => obj.on_off == "on").Count; + Button btnElectricPower = new Button() + { + X = Application.GetRealWidth(120), + Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + SelectedImagePath = "Public/PowerOpen.png", + UnSelectedImagePath = "Public/PowerClose.png", + IsSelected = functionCount == functionOnCount + }; + functionView.AddChidren(btnElectricPower); + btnElectricPower.MouseUpEventHandler = (sender, e) => { + LoadEvent_SwitchFunction(btnElectricPower, item); + }; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(StringId.Electric); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.EnergyMonitoring: + case ShowFunction.EnergyMonitoring: btnName.TextID = StringId.EnergyMonitoring; break; - case FunctionCategory.Environmental: - btnName.TextID = StringId.Environmental; + case ShowFunction.Environmental: + #region 鐜鏁版嵁 + btnName.TextID = StringId.EnvironmentalData; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new EnvironmentalSciencePage(); + MainPage.BasePageView.AddChidren(skipView); + skipView.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion break; - case FunctionCategory.FreshAir: + case ShowFunction.FreshAir: btnName.TextID = StringId.FreshAir; break; - case FunctionCategory.Music: + case ShowFunction.Music: btnName.TextID = StringId.Music; + functionCount = Music.A31MusicModel.A31MusicModelList.Count; + functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.on_off == "on").Count; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var musicMain = new Music.MusicMain(); + MainPage.BasePageView.AddChidren(musicMain); + musicMain.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; break; - case FunctionCategory.Panel: + case ShowFunction.Panel: btnName.TextID = StringId.Panel; break; - case FunctionCategory.SecurityMonitoring: + case ShowFunction.SecurityMonitoring: btnName.TextID = StringId.SecurityMonitoring; break; - case FunctionCategory.Sensor: + case ShowFunction.Sensor: btnName.TextID = StringId.Sensor; + break; - case FunctionCategory.VideoIntercom: + case ShowFunction.VideoIntercom: btnName.TextID = StringId.VideoIntercom; break; } - - Button btnFunctionCount = new Button() + if (item != ShowFunction.Environmental) { - X = Application.GetRealWidth(16), - Y = btnName.Bottom, - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(24), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - TextAlignment = TextAlignment.CenterLeft, - Text = functionOnCount + "/" + functionCount, - Tag = item + "_onCount" - }; - functionView.AddChidren(btnFunctionCount); + Button btnFunctionCount = new Button() + { + X = Application.GetRealWidth(16), + Y = btnName.Bottom, + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(24), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = functionOnCount + "/" + functionCount, + Tag = item + "_onCount" + }; + functionView.AddChidren(btnFunctionCount); - - - + } index++; } - - - #endregion - } - #region 鍒囨崲妤煎眰 /// <summary> @@ -631,7 +708,7 @@ X = Application.GetRealWidth(10), Y = Application.GetRealHeight(100), Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(190), + Height = Application.GetRealHeight(203), BackgroundImagePath = "PersonalCenter/HomeListbg.png", }; dialogBody.AddChidren(dispalyView); @@ -639,15 +716,18 @@ var contentView = new VerticalScrolViewLayout() { X = Application.GetRealWidth(8), - Y = Application.GetRealHeight(10), + Y = Application.GetRealHeight(15), Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(44 * 4), + Height = Application.GetRealHeight(45 * 4), }; dispalyView.AddChidren(contentView); List<string> chooseList = new List<string>(); chooseList.Add(Language.StringByID(StringId.All)); - chooseList.AddRange(DB_ResidenceData.residenceData.floors); + foreach (var f in DB_ResidenceData.residenceData.floors) + { + chooseList.Add(f.name); + } foreach (var floor in chooseList) { @@ -680,9 +760,23 @@ btnHomeName.MouseUpEventHandler += (senderH, en) => { dialog.Close(); - btnFloor.Text = floor; - UserConfig.Instance.SaveUserConfig(); + roomsShowed.Clear(); + if (floor == Language.StringByID(StringId.All)) + { + roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms); + } + else + { + foreach (var room in DB_ResidenceData.residenceData.rooms) + { + if (room.floor == floor) + { + roomsShowed.Add(room); + } + } + } + LoadRoomRows(); }; } -- Gitblit v1.8.0