From a251442d9fc088b3d8cf74d20b959f0f6103b095 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 14 九月 2020 17:42:10 +0800 Subject: [PATCH] 20200914 --- HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 126 +++++++++++++++++++++++++++++++++++------ 1 files changed, 106 insertions(+), 20 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index c9480f1..b8f664b 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -177,7 +177,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextAlignment = TextAlignment.CenterLeft, - Text = OnAppConfig.Instance.CurFoor, + Text = DB_ResidenceData.residenceData.CurFoor, }; roomFloorChangeView.AddChidren(btnFloor); /// <summary> @@ -388,12 +388,8 @@ Y = Application.GetRealHeight(16), Height = Application.GetRealHeight(667 - 64 - 49 + 20), }; - - if (DB_ResidenceData.residenceData.functionTypeList.Count > 4) - { - functionContentView.Height += Application.GetRealHeight((220 * (DB_ResidenceData.residenceData.functionTypeList.Count - 4 - 2) / 2) + 20); - } functionsPageView.AddChidren(functionContentView); + int index = 0; List<int> specialList = new List<int>() { 1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22 }; @@ -415,8 +411,76 @@ var lastY1 = Application.GetRealWidth(16); var lastY2 = Application.GetRealWidth(16); + var functionCategoryCount = 0; + foreach (var item in DB_ResidenceData.residenceData.functionTypeList) { + int functionCount = 0; + int functionOnCount = 0; + switch (item) + { + case ShowFunction.Light: + #region Light + functionCount = DB_ResidenceData.functionList.lights.Count; + functionOnCount = DB_ResidenceData.functionList.lights.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + #endregion + break; + case ShowFunction.AC: + #region AC + functionCount = DB_ResidenceData.functionList.aCs.Count; + functionOnCount = DB_ResidenceData.functionList.aCs.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + #endregion + break; + case ShowFunction.Curtain: + #region Curtain + functionCount = DB_ResidenceData.functionList.curtains.Count; + functionOnCount = DB_ResidenceData.functionList.curtains.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + #endregion + break; + case ShowFunction.FloorHeating: + #region 鍦扮儹 + functionCount = DB_ResidenceData.functionList.floorHeatings.Count; + functionOnCount = DB_ResidenceData.functionList.floorHeatings.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + #endregion + break; + case ShowFunction.DoorLock: + break; + case ShowFunction.Electric: + #region 鐢靛櫒 + functionCount = DB_ResidenceData.functionList.electricals.Count; + functionOnCount = DB_ResidenceData.functionList.electricals.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + #endregion + break; + case ShowFunction.EnergyMonitoring: + break; + case ShowFunction.Environmental: + #region 鐜鏁版嵁 + functionCount = DB_ResidenceData.functionList.sensorsEnvironmentalScience.Count; + #endregion + break; + case ShowFunction.FreshAir: + break; + case ShowFunction.Music: + functionCount = Music.A31MusicModel.A31MusicModelList.Count; + functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; + break; + case ShowFunction.Panel: + break; + case ShowFunction.SecurityMonitoring: + break; + case ShowFunction.Sensor: + break; + case ShowFunction.VideoIntercom: + break; + + } + + if (functionCount == 0 && item != ShowFunction.Music) + { + continue; + } + functionCategoryCount++; + FrameLayout functionView = new FrameLayout() { Height = Application.GetRealWidth(161), @@ -469,8 +533,6 @@ functionView.AddChidren(btnName); - int functionCount = 0; - int functionOnCount = 0; switch (item) { case ShowFunction.Light: @@ -486,9 +548,11 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", - IsSelected = functionCount == functionOnCount + IsSelected = functionOnCount > 0, + Tag = item + "_AllControl", }; functionView.AddChidren(btnLightPower); + btnLightPower.MouseUpEventHandler = (sender, e) => { LoadEvent_SwitchFunction(btnLightPower, item); @@ -515,7 +579,8 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", - IsSelected = functionCount == functionOnCount + Tag = item + "_AllControl", + IsSelected = functionOnCount > 0, }; functionView.AddChidren(btnAcPower); btnAcPower.MouseUpEventHandler = (sender, e) => @@ -545,7 +610,8 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - IsSelected = functionCount == functionOnCount + Tag = item + "_AllControl", + IsSelected = functionOnCount > 0 }; functionView.AddChidren(btnClose); @@ -584,7 +650,8 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", - IsSelected = functionCount == functionOnCount + Tag = item + "_AllControl", + IsSelected = functionOnCount > 0 }; functionView.AddChidren(btnFhPower); btnFhPower.MouseUpEventHandler = (sender, e) => @@ -616,7 +683,8 @@ Height = Application.GetRealWidth(32), SelectedImagePath = "Public/PowerOpen.png", UnSelectedImagePath = "Public/PowerClose.png", - IsSelected = functionCount == functionOnCount + Tag = item + "_AllControl", + IsSelected = functionOnCount > 0, }; functionView.AddChidren(btnElectricPower); btnElectricPower.MouseUpEventHandler = (sender, e) => @@ -677,25 +745,43 @@ break; } - if (item != ShowFunction.Environmental) + if (item != ShowFunction.Environmental && functionCount != 0) { Button btnFunctionCount = new Button() { - X = Application.GetRealWidth(16), + X = Application.GetRealWidth(16)+ Application.GetRealWidth(7 * functionCount.ToString().Length), Y = btnName.Bottom, Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(24), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextAlignment = TextAlignment.CenterLeft, - Text = functionOnCount + "/" + functionCount, - Tag = item + "_onCount" + Text = "/" + functionCount, }; functionView.AddChidren(btnFunctionCount); - + Button btnOpenCount = new Button() + { + X = Application.GetRealWidth(16), + Y = btnName.Bottom, + Width = Application.GetRealWidth(12 * functionCount.ToString().Length), + Height = Application.GetRealHeight(24), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = functionOnCount.ToString(), + Tag = item + "_onCount", + BorderWidth = 0, + }; + functionView.AddChidren(btnOpenCount); } index++; } + + if (functionCategoryCount> 4) + { + functionContentView.Height += Application.GetRealHeight((220 * (functionCategoryCount - 4 - 2) / 2) + 20); + } + #endregion } -- Gitblit v1.8.0