From f345087dbefecef9146fdb13481cb9ee3320d576 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 11:46:28 +0800
Subject: [PATCH] 20201223-2

---
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs |   95 ++++++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index e3103d7..73c1efc 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -64,11 +64,11 @@
         /// </summary>
         void LoadEvet_ChangeFadeTime()
         {
-            barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
-            {
-                light.fadeTime = e;
-                light.SaveFunctionData(true);
-            };
+            //barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
+            //{
+            //    light.fadeTime = e;
+            //    light.SaveFunctionData(true);
+            //};
         }
 
         /// <summary>
@@ -85,13 +85,22 @@
                         //璁剧疆鑷畾涔夌殑鏂囨湰
                         barColorTemplatrue.SetCustomText(value * 100 + "K");
                         light.Attr_CCT.curValue = value * 100;
-                        System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                        d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
-                        Control.Ins.SendWriteCommand(light, d);
+                        //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                        //d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                        //Control.Ins.SendWriteCommand(light, d);
                     });
-                    System.Threading.Thread.Sleep(200);
+                    //System.Threading.Thread.Sleep(200);
                 }).Start();
+            };
+
+            barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) =>
+            {
+                light.Attr_CCT.curValue = value * 100;
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                Control.Ins.SendWriteCommand(light, d);
             };
+
         }
 
         /// <summary>
@@ -101,7 +110,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                light.SaveFunctionData(true);
+                light.CollectFunction();
             };
         }
 
@@ -116,46 +125,48 @@
             dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
                 onDimmerBar = false;
                 light.brightness = dimmerBar.Progress;
-                //Control.Send(CommandType_A.write, light);
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
                 Control.Ins.SendWriteCommand(light, d);
-                light.fadeTime = barFadeTime.Progress;
+                //light.fadeTime = barFadeTime.Progress;
             };
-            dimmerBar.OnProgressChangedEvent = (sender, e) => {
-                light.fadeTime = 0;
-                if (!btnSwitch.IsSelected)
-                {
-                    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
-                }
-                btnSwitch.IsSelected = e > 0 ? true : false;
-                light.brightness = e;
-                light.trait_on_off.curValue = e > 0 ? "on" : "off";
+            dimmerBar.OnProgressChangedEvent = (sender, e) =>
+            {
+                //light.fadeTime = 0;
+                //if (!btnSwitch.IsSelected)
+                //{
+                //    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+                //}
+                //btnSwitch.IsSelected = e > 0 ? true : false;
+                //light.brightness = e;
+                //light.trait_on_off.curValue = e > 0 ? "on" : "off";
 
-                if (e == 0 || e == 100)
-                {
-                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                    Control.Ins.SendWriteCommand(light, d);
-                }
-                else
-                {
-                    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
-                    {
-                        light.refreshTime = DateTime.Now;
-                        new System.Threading.Thread(() =>
-                        {
-                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                            Control.Ins.SendWriteCommand(light, d);
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                }
+                //if (e == 0 || e == 100)
+                //{
+                //    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //    Control.Ins.SendWriteCommand(light, d);
+                //}
+                //else
+                //{
+                //    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+                //    {
+                //        light.refreshTime = DateTime.Now;
+                //        new System.Threading.Thread(() =>
+                //        {
+                //            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //            Control.Ins.SendWriteCommand(light, d);
+                //        })
+                //        { IsBackground = true }.Start();
+                //    }
+                //}
 
                 btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
                 btnBrightnessText.Text = light.brightness + "%";
             };
+
+
         }
 
         /// <summary>
@@ -165,7 +176,7 @@
         {
             btnSwitch.MouseUpEventHandler += (sender, e) =>
             {
-                light.fadeTime = barFadeTime.Progress;
+                //light.fadeTime = barFadeTime.Progress;
                 btnSwitch.IsSelected = !btnSwitch.IsSelected;
                 if (btnSwitch.IsSelected)
                 {

--
Gitblit v1.8.0