| | |
| | | |
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; |
| | | |
| | | if (function.Spk_Prefix == FunctionCategory.Curtain//窗帘没有开关按钮 |
| | | || function.Spk_Prefix == FunctionCategory.Music//音乐没有开关按钮 |
| | | || function.Spk_Prefix == FunctionCategory.Sensor//传感器没有开关按钮 |
| | | ) |
| | | 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: |
| | | CurtainFragment(); |
| | | break; |
| | | case FunctionCategory.Sensor: |
| | | var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); |
| | | if (powerLowTipAttr != null) |
| | | if (powerLowTipAttr.state.ToLower() == "low") |
| | | { |
| | | Button btnTipPowerLow = new Button() |
| | | { |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | break; |
| | | case FunctionCategory.Music: |
| | | 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 |
| | |
| | | LoadEvent_SwitchFunction(btnSwitch); |
| | | } |
| | | |
| | | switch (function.Spk_Prefix) |
| | | if (SPK.AcSpkList().Contains(function.spk) || |
| | | SPK.FhSpkList().Contains(function.spk)) |
| | | { |
| | | case FunctionCategory.AC: |
| | | LoadLastStatesButton(); |
| | | break; |
| | | case FunctionCategory.IR: |
| | | LoadLastStatesButton(); |
| | | break; |
| | | case FunctionCategory.FloorHeat: |
| | | LoadLastStatesButton(); |
| | | break; |
| | | case FunctionCategory.Light: |
| | | //btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; |
| | | btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; |
| | | LoadLightControl(); |
| | | break; |
| | | case FunctionCategory.Electric: |
| | | 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 |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0", |
| | | 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() |
| | | { |
| | |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", |
| | | Tag = function.sid + "_on", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0" |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.OnOff) == "on", |
| | | }; |
| | | bodyDiv.AddChidren(btnCurtainOpen); |
| | | if (function.spk == SPK.CurtainRoller) |
| | | { |
| | | btnCurtainOpen.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainUpIcon.png"; |
| | | btnCurtainOpen.SelectedImagePath = "FunctionIcon/Curtain/CurtainUpIconOn.png"; |
| | | } |
| | | LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function); |
| | | #endregion |
| | | } |
| | |
| | | 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); |