From e13a9980ce617db1394a76944186c5d5bd595d5d Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 02 六月 2021 14:37:12 +0800
Subject: [PATCH] 5月需求bug修复

---
 HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs |   95 +++++++++++------------------------------------
 1 files changed, 22 insertions(+), 73 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
index f0a079e..e0dbadc 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
@@ -61,6 +61,8 @@
             }
             LoadDiv();
 
+            btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png";
+
             if (function.Spk_Prefix == FunctionCategory.Curtain//绐楀笜娌℃湁寮�鍏虫寜閽�
                 || function.Spk_Prefix == FunctionCategory.Music//闊充箰娌℃湁寮�鍏虫寜閽�
                 || function.Spk_Prefix == FunctionCategory.Sensor//浼犳劅鍣ㄦ病鏈夊紑鍏虫寜閽�
@@ -69,39 +71,9 @@
                 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.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.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState);
                         if (powerLowTipAttr != null)
                         {
@@ -122,7 +94,6 @@
 
                         break;
                     case FunctionCategory.Music:
-                        btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png";
                         MusicFragment();
                         break;
 
@@ -132,7 +103,6 @@
             {
                 if (function.spk == SPK.ClothesHanger)//鏅捐。鏋�
                 {
-                    btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerGrayIcon.png";
                     ClothesHangerFragment();
                 }
                 else
@@ -181,51 +151,20 @@
                     switch (function.Spk_Prefix)
                     {
                         case FunctionCategory.AC:
-                            switch (function.spk)
-                            {
-                                case SPK.AcStandard:
-                                    btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png";
-                                    LoadLastStatesButton();
-                                    break;
-                            }
+                            LoadLastStatesButton();
+                            break;
+                        case FunctionCategory.IR:
+                            LoadLastStatesButton();
                             break;
                         case FunctionCategory.FloorHeat:
-                            switch (function.spk)
-                            {
-                                case SPK.FloorHeatStandard:
-                                    btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
-                                    LoadLastStatesButton();
-                                    break;
-                            }
+                            LoadLastStatesButton();
                             break;
                         case FunctionCategory.Light:
-                            btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png";
+                            //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;
                     }
@@ -289,7 +228,7 @@
             };
             //bodyDiv.AddChidren(btnCollectionIcon);
             //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
-            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare && function.Spk_Prefix != FunctionCategory.Sensor)
+            if ( function.Spk_Prefix != FunctionCategory.Sensor)//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare &&
             {
                 bodyDiv.AddChidren(btnCollectionIcon);
             }
@@ -331,7 +270,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),
                     };
@@ -374,6 +313,11 @@
                 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()
             {
@@ -399,7 +343,12 @@
                 IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0"
             };
             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>
@@ -460,7 +409,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