From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 01 十二月 2021 16:32:57 +0800 Subject: [PATCH] 2021-12-01-01 --- HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 176 ++++++++++++++++++---------------------------------------- 1 files changed, 54 insertions(+), 122 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index 1a88c32..9a7fe8d 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -61,78 +61,40 @@ } LoadDiv(); - if (function.Spk_Prefix == FunctionCategory.Curtain//绐楀笜娌℃湁寮�鍏虫寜閽� - || function.Spk_Prefix == FunctionCategory.Music//闊充箰娌℃湁寮�鍏虫寜閽� - || function.Spk_Prefix == FunctionCategory.Sensor//浼犳劅鍣ㄦ病鏈夊紑鍏虫寜閽� - ) + btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; + + if (SPK.CurtainSpkList().Contains(function.spk)) + {//绐楀笜娌℃湁寮�鍏虫寜閽� + CurtainFragment(); + } + else if (SPK.MusicSpkList().Contains(function.spk)) + {//闊充箰娌℃湁寮�鍏虫寜閽� + MusicFragment(); + } + else if (SPK.EvironmentSensorList().Contains(function.spk) || SPK.ArmSensorSpkList().Contains(function.spk)) //浼犳劅鍣ㄦ病鏈夊紑鍏虫寜閽�) { - switch (function.Spk_Prefix) + var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); + if (powerLowTipAttr != null) { - case FunctionCategory.Curtain: - switch (function.spk) + if (powerLowTipAttr.state.ToLower() == "low") + { + Button btnTipPowerLow = new Button() { - case SPK.CurtainSwitch: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png"; - break; - case SPK.CurtainTrietex: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/MotorCurtainIcon.png"; - break; - case SPK.CurtainRoller: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/RollingShutterIcon.png"; - break; - } - CurtainFragment(); - break; - case FunctionCategory.Sensor: - switch (function.spk) - { - case SPK.SensorPir: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorPirIcon.png"; - break; - case SPK.SensorWater: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorWaterImmersionIcon.png"; - break; - case SPK.SensorSmoke: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeIcon.png"; - break; - case SPK.SensorDoorWindow: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorDoorIcon.png"; - break; - default: - - break; - } - var powerLowTipAttr = function.status.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); - if (powerLowTipAttr != null) - { - if (powerLowTipAttr.value.ToLower() == "low") - { - Button btnTipPowerLow = new Button() - { - X = Application.GetRealWidth(307), - Y = Application.GetRealHeight(25), - Width = Application.GetRealWidth(24), - Height = Application.GetRealWidth(24), - UnSelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png", - SelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png", - }; - this.AddChidren(btnTipPowerLow); - } - } - - break; - case FunctionCategory.Music: - btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png"; - MusicFragment(); - break; - + X = Application.GetRealWidth(307), + Y = Application.GetRealHeight(25), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + UnSelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png", + SelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png", + }; + this.AddChidren(btnTipPowerLow); + } } } else { if (function.spk == SPK.ClothesHanger)//鏅捐。鏋� { - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerGrayIcon.png"; ClothesHangerFragment(); } else @@ -178,56 +140,19 @@ LoadEvent_SwitchFunction(btnSwitch); } - switch (function.Spk_Prefix) + if (SPK.AcSpkList().Contains(function.spk) || + SPK.FhSpkList().Contains(function.spk)) { - case FunctionCategory.AC: - switch (function.spk) - { - case SPK.AcStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; - LoadLastStatesButton(); - break; - } - break; - case FunctionCategory.FloorHeat: - switch (function.spk) - { - case SPK.FloorHeatStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; - LoadLastStatesButton(); - break; - } - break; - case FunctionCategory.Light: - btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; - btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; - LoadLightControl(); - break; - case FunctionCategory.Electric: - switch (function.spk) - { - case SPK.ElectricSocket: - btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketThinIcon.png"; - break; - case SPK.ElectricFan: - case SPK.ElectricTuyaFan: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanThinIcon.png"; - break; - case SPK.ElectricTV: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVThinIcon.png"; - break; - case SPK.ElectricTuyaAirCleaner: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/AirCleanerThiinIcon.png"; - break; - case SPK.ElectricTuyaWeepRobot: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobotThinIcon.png"; - break; - case SPK.ElectricTuyaWaterValve: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WaterValve/WaterValveIcon.png"; - break; - } - btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; - break; + LoadLastStatesButton(); + } + else if (SPK.LightSpkList().Contains(function.spk)) + { + btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; + LoadLightControl(); + } + else if (SPK.ElectricalSpkList().Contains(function.spk)) + { + btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; } #endregion } @@ -287,9 +212,7 @@ UnSelectedImagePath = "Collection/CollectionGrayIcon.png", IsSelected = function.collect }; - //bodyDiv.AddChidren(btnCollectionIcon); - //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� - if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare && function.Spk_Prefix != FunctionCategory.Sensor) + if ( !SPK.ArmSensorSpkList().Contains(function.spk) && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && { bodyDiv.AddChidren(btnCollectionIcon); } @@ -331,7 +254,7 @@ ProgressTextColor = CSS_Color.FirstLevelTitleColor, ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, MaxValue = 100, - Progress = (function as Light).brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), Tag = function.sid + "_DimmerBar", SeekBarPadding = Application.GetRealWidth(20), }; @@ -370,10 +293,15 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - IsSelected = function.trait_on_off.curValue.ToString() == "off", + IsSelected = function.GetAttrState(FunctionAttributeKey.OnOff) == "off", Tag = function.sid + "_off" }; bodyDiv.AddChidren(btnCurtainClose); + if(function.spk == SPK.CurtainRoller) + { + btnCurtainClose.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainDownIcon.png"; + btnCurtainClose.SelectedImagePath = "FunctionIcon/Curtain/CurtainDownIconOn.png"; + } var btnCurtainStop = new Button() { @@ -384,7 +312,6 @@ UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", Tag = function.sid + "_stop", - IsSelected = function.trait_on_off.curValue.ToString() == "stop" }; bodyDiv.AddChidren(btnCurtainStop); @@ -397,10 +324,15 @@ UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", Tag = function.sid + "_on", - IsSelected = function.trait_on_off.curValue.ToString() == "on" + IsSelected = function.GetAttrState(FunctionAttributeKey.OnOff) == "on", }; bodyDiv.AddChidren(btnCurtainOpen); - LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function as Curtain); + if (function.spk == SPK.CurtainRoller) + { + btnCurtainOpen.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainUpIcon.png"; + btnCurtainOpen.SelectedImagePath = "FunctionIcon/Curtain/CurtainUpIconOn.png"; + } + LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function); #endregion } /// <summary> @@ -430,7 +362,7 @@ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1On.png", }; bodyDiv.AddChidren(btnClothesHangerDown); - LoadEvent_ControlClothesHanger(function, btnClothesHangerDown, btnClothesHangerUp); + LoadEvent_ControlClothesHanger(function, btnClothesHangerUp, btnClothesHangerDown); #endregion @@ -461,7 +393,7 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "MusicIcon/pause.png", SelectedImagePath = "MusicIcon/play.png", - IsSelected = (function as A31MusicModel).A31PlayStatus.status == "play" , + //IsSelected = (function as A31MusicModel).A31PlayStatus.status == "play" , Tag = function.spk + "_State_" + function.sid }; bodyDiv.AddChidren(btnPlay); -- Gitblit v1.8.0