From dce6c3481a37216292724013ff9d2b75ceb82f86 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 10 六月 2020 15:47:28 +0800
Subject: [PATCH] 添加小度的代码

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs
similarity index 92%
rename from ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
rename to ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs
index 66122d1..6408315 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs
@@ -8,9 +8,9 @@
 namespace Shared.Phone.MainPage.ControlForm
 {
     /// <summary>
-    /// 褰╃伅(璋冨厜鍣�)绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈�
+    /// 鑹叉俯鐏被鍨嬬殑娣卞害鍗$墖鐣岄潰
     /// </summary>
-    public class DeviceMiniLightDetailCardForm : DeviceDetailCardCommonForm
+    public class DeviceColorTemperatureLightDetailCardForm : DeviceDetailCardCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -73,7 +73,7 @@
             waveSeekBar.Gravity = Gravity.CenterHorizontal;
             waveSeekBar.WavePadding = Application.GetRealWidth(8);
             waveSeekBar.MaxValue = 100;
-            waveSeekBar.Progress = (int)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
+            waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
             waveSeekBar.CornerRadius = Application.GetRealHeight(58);
             frameWhiteBack.AddChidren(waveSeekBar);
 
@@ -157,7 +157,7 @@
                 else
                 {
                     //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛�
-                    ((DimmableLight)this.device).Level = value * MaxLevel / 100;
+                    ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
                     //浜害 XX
                     this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                 }
@@ -200,8 +200,10 @@
                 }
             };
             //璁剧疆鍒濆鍊�
-            seekBar1.Progress = 34;
-            btnColorView.Text = 34 * 100 + "K";
+            int colorValue = ((ColorTemperatureLight)this.device).ColorTemperature;
+            if (colorValue == 0) { colorValue = 3400; }
+            seekBar1.Progress = colorValue / 100;
+            btnColorView.Text = colorValue + "K";
 
             //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆�
             HdlThreadLogic.Current.RunThread(() =>
@@ -216,12 +218,13 @@
                         if (nowProgressValue != oldProgressValue)
                         {
                             oldProgressValue = nowProgressValue;
-                            ((DimmableLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
+                            ((ColorTemperatureLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
                         }
                         //鍙戦�佽壊娓╁��
                         if (nowColorValue != oldColorValue)
                         {
                             oldColorValue = nowColorValue;
+                            ((ColorTemperatureLight)this.device).SetColorTemperature(oldColorValue * 100);
                         }
                     }
                 }
@@ -229,11 +232,12 @@
                 if (nowProgressValue != oldProgressValue)
                 {
                     //鍙戦�佷寒搴﹀��
-                    ((DimmableLight)this.device).SetLevel((int)(nowProgressValue * MaxLevel / 100.0));
+                    ((ColorTemperatureLight)this.device).SetLevel((int)(nowProgressValue * MaxLevel / 100.0));
                 }
                 if (nowColorValue != oldColorValue)
                 {
                     //鍙戦�佽壊娓╁��
+                    ((ColorTemperatureLight)this.device).SetColorTemperature(nowColorValue * 100);
                 }
             });
         }
@@ -337,7 +341,7 @@
                 if (this.isProgressing == false)
                 {
                     //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫�
-                    waveSeekBar.Progress = (int)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
+                    waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
                 }
             }
             if (isOpen == false && this.IsLightOpen == true)

--
Gitblit v1.8.0