From c3e1b733fc45bd9f0b88bfb560cfa87a270b079b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 09 九月 2020 17:33:58 +0800 Subject: [PATCH] 20200909 --- HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 110 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 96 insertions(+), 14 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index c9480f1..e0d86f7 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -417,6 +417,72 @@ 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; + } + FrameLayout functionView = new FrameLayout() { Height = Application.GetRealWidth(161), @@ -469,8 +535,6 @@ functionView.AddChidren(btnName); - int functionCount = 0; - int functionOnCount = 0; switch (item) { case ShowFunction.Light: @@ -486,9 +550,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 +581,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 +612,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 +652,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 +685,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,22 +747,34 @@ 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++; } -- Gitblit v1.8.0