From f982455916297ab07379d902a7f15b7a7a867c94 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 20 十月 2021 09:19:20 +0800
Subject: [PATCH] 1
---
HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 87 ++++++++++++++++++-------------------------
1 files changed, 36 insertions(+), 51 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
index 27ce249..9a7fe8d 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
@@ -63,40 +63,32 @@
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
@@ -148,24 +140,19 @@
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:
- 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
}
@@ -225,9 +212,7 @@
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
IsSelected = function.collect
};
- //bodyDiv.AddChidren(btnCollectionIcon);
- //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
- if ( function.Spk_Prefix != FunctionCategory.Sensor)//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare &&
+ if ( !SPK.ArmSensorSpkList().Contains(function.spk) && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare &&
{
bodyDiv.AddChidren(btnCollectionIcon);
}
--
Gitblit v1.8.0