From 1fa13087ee7be5502e2e42cbd07cf185cbc69a9c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 12 十月 2023 13:57:23 +0800
Subject: [PATCH] Merge branch 'wxr-2.1' into wxr-2.2

---
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs |  109 ++++++++++++++++++------------------------------------
 1 files changed, 36 insertions(+), 73 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index c9d675a..ecb9937 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -7,98 +7,61 @@
 {
     public partial class ColorTureLampPage
     {
-        /// <summary>
-        /// 閫氱煡鏇存柊鐣岄潰鐨勬椂闂�
-        /// </summary>
-        DateTime notiyUpdateTime = DateTime.MinValue;
-        System.Threading.Thread updateUiThread;
-        object lockObj = new object();
+
         /// <summary>
         /// 鏇存柊鍔熻兘鐘舵��
         /// </summary>
         public static void UpdataStatus(Function updataTemp)
-        { 
-            if(bodyView == null)
+        {
+            if (bodyView == null)
             {
                 return;
             }
-            lock (bodyView.lockObj)
+
+            Application.RunOnMainThread(() =>
             {
-                MainPage.Log($"鏀跺埌鏇存柊" + DateTime.Now.Ticks);
-                bodyView.notiyUpdateTime = DateTime.Now;
-                if (bodyView.updateUiThread == null)
+                try
                 {
-                    bodyView.updateUiThread = new System.Threading.Thread(() =>
+                    if (bodyView == null)
+                        return;
+                    if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
                     {
-                        while (true)
+                        if (updataTemp.trait_on_off.curValue.ToString() == "on")
                         {
-                            System.Threading.Thread.Sleep(1500);
-                            if (bodyView == null)
+                            bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+                            if (!bodyView.onDimmerBar)
                             {
-                                return;
+                                bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness));
                             }
-                            if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime)
+                            if (updataTemp.GetAttrState(FunctionAttributeKey.Brightness) != "0")
                             {
-                                MainPage.Log("娌℃湁鏂版暟鎹紝鏇存柊UI");
-                                break;
-                            }
-                            else
-                            {
-                                MainPage.Log("鏈夋柊鏁版嵁锛岀户缁瓑寰�");
+                                bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+                                bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
                             }
                         }
-
-                        Application.RunOnMainThread(() =>
+                        else
                         {
-                            try
-                            {
-                                if (bodyView == null)
-                                    return;
-                                if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
-                                {
-                                    if (updataTemp.trait_on_off.curValue.ToString() == "on")
-                                    {
-                                        bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
-                                        if (!bodyView.onDimmerBar)
-                                        {
-                                            bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness));
-                                        }
-                                        if (updataTemp.GetAttrState(FunctionAttributeKey.Brightness) != "0")
-                                        {
-                                            bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
-                                            bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
-                                        }
-                                    }
-                                    else
-                                    {
-                                        bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
-                                    }
-                                    bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
-                                    bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on";
-                                    var cct = 27;
-                                    int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct);
-                                    bodyView.barColorTemplatrue.Progress = cct / 100;
-                                    //璁剧疆鍒濆鍊�
-                                    bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K");
+                            bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
+                        }
+                        bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
+                        bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on";
+                        var cct = 27;
+                        int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct);
+                        bodyView.barColorTemplatrue.Progress = cct / 100;
+                        //璁剧疆鍒濆鍊�
+                        bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K");
 
-                                }
-                            }
-                            catch (Exception ex)
-                            {
-                                MainPage.Log($"{bodyView.GetType().Name} UpdataStates error : {ex.Message}");
-                            }
-                            finally
-                            {
-                                bodyView.updateUiThread = null;
-                            }
-
-                        });
-
-                        bodyView.updateUiThread.IsBackground = true;
-                        bodyView.updateUiThread.Start();
-                    });
+                    }
                 }
-            }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"{bodyView.GetType().Name} UpdataStates error : {ex.Message}");
+                }
+                finally
+                {
+                }
+
+            });
         }
 
         void LoadEventList()

--
Gitblit v1.8.0