| | |
| | | /// </summary> |
| | | public void LoadFunctionDiv() |
| | | { |
| | | //todo 增加设备,增加功能列表卡片 |
| | | if (function == null) |
| | | { |
| | | this.RemoveFromParent(); |
| | |
| | | } |
| | | LoadDiv(); |
| | | |
| | | if (function.functionCategory == FunctionCategory.Curtain || function.functionCategory == FunctionCategory.Music || function.functionCategory == FunctionCategory.Scene)//窗帘没有开关按钮 |
| | | if (function.Spk_Prefix == FunctionCategory.Curtain//窗帘没有开关按钮 |
| | | || function.Spk_Prefix == FunctionCategory.Music//音乐没有开关按钮 |
| | | || function.Spk_Prefix == FunctionCategory.Sensor//传感器没有开关按钮 |
| | | ) |
| | | { |
| | | switch (function.functionCategory) |
| | | switch (function.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.Curtain: |
| | | switch(function.functionType) |
| | | switch (function.spk) |
| | | { |
| | | case FunctionType.Curtain: |
| | | case SPK.CurtainSwitch: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png"; |
| | | break; |
| | | case FunctionType.MotorCurtain: |
| | | case SPK.CurtainTrietex: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/MotorCurtainIcon.png"; |
| | | break; |
| | | case FunctionType.RollingShutter: |
| | | 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; |
| | | |
| | | } |
| | | break; |
| | | case FunctionCategory.Music: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png"; |
| | |
| | | /// 开关按钮 |
| | | /// </summary> |
| | | Button btnSwitch; |
| | | if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer) |
| | | if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) |
| | | { |
| | | btnSwitch = new Button() |
| | | { |
| | |
| | | }; |
| | | bodyDiv.AddChidren(btnSwitch); |
| | | //加载开关按钮事件 |
| | | LoadEvent_SwitchFunction(btnSwitch,function.attributes.Find((obj)=> obj.key == FunctionAttributeKey.FadeTime )); |
| | | LoadEvent_SwitchFunction(btnSwitch, function.attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); |
| | | } |
| | | else |
| | | { |
| | |
| | | LoadEvent_SwitchFunction(btnSwitch); |
| | | } |
| | | |
| | | switch (function.functionCategory) |
| | | switch (function.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.Thermostat: |
| | | switch (function.functionType) |
| | | case FunctionCategory.AC: |
| | | switch (function.spk) |
| | | { |
| | | case FunctionType.AC: |
| | | case SPK.AcStandard: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; |
| | | LoadLastStatesButton(); |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | } |
| | | break; |
| | | case FunctionCategory.FloorHeat: |
| | | switch (function.spk) |
| | | { |
| | | case SPK.FloorHeatStandard: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; |
| | | LoadLastStatesButton(); |
| | | break; |
| | |
| | | btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; |
| | | LoadLightControl(); |
| | | break; |
| | | case FunctionCategory.SwitchDevice: |
| | | switch (function.functionType) |
| | | case FunctionCategory.Electric: |
| | | switch (function.spk) |
| | | { |
| | | case FunctionType.Socket: |
| | | case SPK.ElectricSocket: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketThinIcon.png"; |
| | | break; |
| | | } |
| | | btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; |
| | | break; |
| | | case FunctionCategory.Electrical: |
| | | switch (function.functionType) |
| | | { |
| | | case FunctionType.Fan: |
| | | case SPK.ElectricFan:
|
| | | case SPK.ElectricTuyaFan: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanThinIcon.png"; |
| | | break; |
| | | case FunctionType.TV: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVThinIcon.png"; |
| | | 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"; |
| | |
| | | #endregion |
| | | } |
| | | |
| | | if (function.functionCategory != FunctionCategory.Scene) |
| | | { |
| | | LoadEvent_DivSkipEvent(); |
| | | } |
| | | LoadEvent_DivSkipEvent(); |
| | | LoadEvent_FunctionCollection(); |
| | | } |
| | | |
| | |
| | | }; |
| | | //bodyDiv.AddChidren(btnCollectionIcon); |
| | | //2020-12-16 如果是成员隐藏收藏功能 |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare && function.Spk_Prefix != FunctionCategory.Sensor) |
| | | { |
| | | bodyDiv.AddChidren(btnCollectionIcon); |
| | | } |
| | |
| | | /// </summary> |
| | | void LoadLightControl() |
| | | { |
| | | switch (function.functionType) |
| | | switch (function.spk) |
| | | { |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | #region Dimmer |
| | | var btnDimmerMinValues = new Button() |
| | | { |
| | |
| | | UnSelectedImagePath = "MusicIcon/pause.png", |
| | | SelectedImagePath = "MusicIcon/play.png", |
| | | IsSelected = (function as A31MusicModel).A31PlayStatus.status == "play" , |
| | | Tag = function.functionType + "_State_" + function.sid |
| | | Tag = function.spk + "_State_" + function.sid |
| | | }; |
| | | bodyDiv.AddChidren(btnPlay); |
| | | |
| | |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能状态信息按钮 |
| | | /// </summary> |
| | | void LoadLastStatesButton() |
| | | { |
| | | if(function.spk == SPK.LightSwitch) |
| | | { |
| | | return; |
| | | } |
| | | var btnLastStates = new Button() |
| | | { |
| | | X = Application.GetRealWidth(10 + 32 + 8), |
| | |
| | | SelectedTextColor = CSS_Color.PromptingColor1, |
| | | TextColor = 0x00000000, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | Tag = function.functionType + "_laststates_" + function.sid, |
| | | Tag = function.spk + "_laststates_" + function.sid, |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | }; |
| | | bodyDiv.AddChidren(btnLastStates); |