From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
index 471b9df..4c219f0 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
@@ -31,10 +31,6 @@
         /// </summary>
         private SeekBarControl seekBarColor = null;
         /// <summary>
-        /// MaxLevel
-        /// </summary>
-        private const int MaxLevel = 254;
-        /// <summary>
         /// 浜害杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓�
         /// </summary>
         private bool isLightProgressing = false;
@@ -66,7 +62,7 @@
             if (((LightBase)this.device).OnOffStatus == 1)
             {
                 //浜害 XX
-                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
+                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
             }
             else
             {
@@ -81,7 +77,7 @@
             btnLightView.Y = Application.GetRealHeight(320);
             frameWhiteBack.AddChidren(btnLightView);
             //搴曠嚎
-            var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
+            var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
             btnLightLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
             btnLightLine.X = btnLightView.X;
             btnLightLine.Y = btnLightView.Bottom + Application.GetRealHeight(37);
@@ -98,7 +94,7 @@
             seekBarLight.ProgressTextSize = 14;
             seekBarLight.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
             seekBarLight.Gravity = Gravity.Frame;
-            seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
+            seekBarLight.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
             frameWhiteBack.AddChidren(seekBarLight);
 
             //鑹叉俯
@@ -108,7 +104,7 @@
             btnColorView.Y = btnLightLine.Y + Application.GetRealHeight(107);
             frameWhiteBack.AddChidren(btnColorView);
             //搴曠嚎
-            var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
+            var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
             btnColorLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
             btnColorLine.X = btnColorView.X;
             btnColorLine.Y = btnColorView.Bottom + Application.GetRealHeight(37);
@@ -150,7 +146,7 @@
             btnBuzzerView.Y = btnColorLine.Y + Application.GetRealHeight(107);
             frameWhiteBack.AddChidren(btnBuzzerView);
             //搴曠嚎
-            var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
+            var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
             btnBuzzerLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
             btnBuzzerLine.X = btnBuzzerView.X;
             btnBuzzerLine.Y = btnBuzzerView.Bottom + Application.GetRealHeight(37);
@@ -178,7 +174,7 @@
             btnMiniView.Y = btnBuzzerLine.Y + Application.GetRealHeight(107);
             frameWhiteBack.AddChidren(btnMiniView);
             //搴曠嚎
-            var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
+            var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
             btnMiniLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
             btnMiniLine.X = btnMiniView.X;
             btnMiniLine.Y = btnMiniView.Bottom + Application.GetRealHeight(37);
@@ -226,9 +222,9 @@
                 else
                 {
                     //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛�
-                    ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
+                    ((ColorTemperatureLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
                     //浜害 XX
-                    this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
+                    this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                 }
             };
 
@@ -281,7 +277,7 @@
                     if (nowLightValue != oldLightValue)
                     {
                         oldLightValue = nowLightValue;
-                        ((ColorTemperatureLight)this.device).SetLevel((int)(oldLightValue * MaxLevel / 100.0));
+                        ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldLightValue));
                     }
                     //鍙戦�佽壊娓╁��
                     if (nowColorValue != oldColorValue)
@@ -295,7 +291,7 @@
                 if (nowLightValue != oldLightValue)
                 {
                     //鍙戦�佷寒搴﹀��
-                    ((ColorTemperatureLight)this.device).SetLevel((int)(nowLightValue * MaxLevel / 100.0));
+                    ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(nowLightValue));
                 }
                 if (nowColorValue != oldColorValue)
                 {
@@ -354,7 +350,7 @@
                 if (level == 0)
                 {
                     //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�0鐨勮瘽,鍒欓渶瑕佸彉鎴�100%浜害
-                    this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
+                    this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 255 });
                 }
                 else
                 {
@@ -412,10 +408,10 @@
         private void AddReceiveBuzzerAckEvent()
         {
             //Ack涓婚涓婃姤
-            string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.device);
+            string mainKeys = LocalDevice.Current.GetDeviceMainKeys(this.device);
             HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceBuzzerDetailCardACK", ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, (report) =>
             {
-                string mainKey2 = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
+                string mainKey2 = LocalDevice.Current.GetDeviceMainKeys(report);
                 if (mainKeys != mainKey2)
                 {
                     //涓嶆槸鍚屼竴涓笢瑗�
@@ -474,7 +470,7 @@
             if (isOpen == true)
             {
                 //浜害鏄繀椤昏鍒锋柊鐨�  浜害 XX
-                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
+                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                 if (this.btnMiniSwitch.IsSelected == false)
                 {
                     this.btnMiniSwitch.IsSelected = true;
@@ -493,7 +489,11 @@
             if (this.isLightProgressing == false)
             {
                 //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫�
-                seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
+                int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
+                if (seekBarLight.Progress != progress)
+                {
+                    seekBarLight.Progress = progress;
+                }
             }
             if (this.isColorProgressing == false)
             {

--
Gitblit v1.8.0