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 | 241 +++++++++++++++++++++++++---------------------- 1 files changed, 127 insertions(+), 114 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index f81a3b0..9a7fe8d 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -61,126 +61,101 @@ } LoadDiv(); - if (function.Spk_Prefix == FunctionCategory.Curtain || function.Spk_Prefix == FunctionCategory.Music)//绐楀笜娌℃湁寮�鍏虫寜閽� - { - switch (function.Spk_Prefix) - { - case FunctionCategory.Curtain: - switch (function.spk) - { - 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.Music: - btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png"; - MusicFragment(); - break; + 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)) //浼犳劅鍣ㄦ病鏈夊紑鍏虫寜閽�) + { + var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); + if (powerLowTipAttr != null) + { + if (powerLowTipAttr.state.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); + } } } else { - #region 鍔犺浇寮�鍏虫寜閽� - /// <summary> - /// 寮�鍏虫寜閽� - /// </summary> - Button btnSwitch; - if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) + if (function.spk == SPK.ClothesHanger)//鏅捐。鏋� { - btnSwitch = new Button() - { - X = Application.GetRealWidth(303), - Y = Application.GetRealHeight(78), - Width = Application.GetMinRealAverage(32), - Height = Application.GetMinRealAverage(32), - UnSelectedImagePath = "Public/PowerClose.png", - SelectedImagePath = "Public/PowerOpen.png", - IsSelected = function.trait_on_off.curValue.ToString() == "on", - Tag = function.sid + "_Switch", - }; - bodyDiv.AddChidren(btnSwitch); - //鍔犺浇寮�鍏虫寜閽簨浠� - LoadEvent_SwitchFunction(btnSwitch, function.attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); + ClothesHangerFragment(); } else { - btnSwitch = new Button() - { - X = Application.GetRealWidth(303), - Y = Application.GetRealHeight(58), - Width = Application.GetMinRealAverage(32), - Height = Application.GetMinRealAverage(32), - UnSelectedImagePath = "Public/PowerClose.png", - SelectedImagePath = "Public/PowerOpen.png", - IsSelected = function.trait_on_off.curValue.ToString() == "on", - Tag = function.sid + "_Switch", - }; - bodyDiv.AddChidren(btnSwitch); - //鍔犺浇寮�鍏虫寜閽簨浠� - LoadEvent_SwitchFunction(btnSwitch); - } + #region 鍔犺浇寮�鍏虫寜閽� - switch (function.Spk_Prefix) - { - case FunctionCategory.AC: - switch (function.spk) + /// <summary> + /// 寮�鍏虫寜閽� + /// </summary> + Button btnSwitch; + if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) + { + btnSwitch = new Button() { - case SPK.AcStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; - LoadLastStatesButton(); - break; - } - break; - case FunctionCategory.FloorHeat: - switch (function.spk) + X = Application.GetRealWidth(303), + Y = Application.GetRealHeight(78), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "Public/PowerClose.png", + SelectedImagePath = "Public/PowerOpen.png", + IsSelected = function.trait_on_off.curValue.ToString() == "on", + Tag = function.sid + "_Switch", + }; + bodyDiv.AddChidren(btnSwitch); + //鍔犺浇寮�鍏虫寜閽簨浠� + LoadEvent_SwitchFunction(btnSwitch, function.attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); + } + else + { + btnSwitch = new Button() { - case SPK.FloorHeatStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; - LoadLastStatesButton(); - break; - } - break; - case FunctionCategory.Light: - btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; + X = Application.GetRealWidth(303), + Y = Application.GetRealHeight(58), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "Public/PowerClose.png", + SelectedImagePath = "Public/PowerOpen.png", + IsSelected = function.trait_on_off.curValue.ToString() == "on", + Tag = function.sid + "_Switch", + }; + bodyDiv.AddChidren(btnSwitch); + //鍔犺浇寮�鍏虫寜閽簨浠� + LoadEvent_SwitchFunction(btnSwitch); + } + + if (SPK.AcSpkList().Contains(function.spk) || + SPK.FhSpkList().Contains(function.spk)) + { + LoadLastStatesButton(); + } + else if (SPK.LightSpkList().Contains(function.spk)) + { 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; - } + } + else if (SPK.ElectricalSpkList().Contains(function.spk)) + { btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; - break; + } + #endregion } - #endregion } LoadEvent_DivSkipEvent(); @@ -237,9 +212,7 @@ UnSelectedImagePath = "Collection/CollectionGrayIcon.png", IsSelected = function.collect }; - //bodyDiv.AddChidren(btnCollectionIcon); - //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� - if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) + if ( !SPK.ArmSensorSpkList().Contains(function.spk) && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && { bodyDiv.AddChidren(btnCollectionIcon); } @@ -281,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), }; @@ -320,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() { @@ -334,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); @@ -347,11 +324,48 @@ 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> + /// 鍔犺浇鏅捐。鏋跺姛鑳芥帶鍒跺崱鐗� + /// </summary> + void ClothesHangerFragment() + { + #region ClothesHanger + var btnClothesHangerUp = new Button() + { + X = Application.GetRealWidth(233), + Y = Application.GetRealHeight(58), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerUpIcon1.png", + SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerUpIcon1On.png", + }; + bodyDiv.AddChidren(btnClothesHangerUp); + + var btnClothesHangerDown = new Button() + { + X = Application.GetRealWidth(303), + Y = Application.GetRealHeight(58), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1.png", + SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1On.png", + }; + bodyDiv.AddChidren(btnClothesHangerDown); + LoadEvent_ControlClothesHanger(function, btnClothesHangerUp, btnClothesHangerDown); + #endregion + + } /// <summary> @@ -379,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); @@ -397,7 +411,6 @@ LoadEvent_ControlMusic(btnPlay, btnNext, btnPrev, function as A31MusicModel); #endregion } - /// <summary> /// 鍔犺浇鍔熻兘鐘舵�佷俊鎭寜閽� -- Gitblit v1.8.0