From f718d23a262a5a8e1241fdeaeb4153399f95e79d Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 21 四月 2020 09:19:05 +0800 Subject: [PATCH] 20200421 --- HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 72 +++++++++++++++++++++++++++-------- 1 files changed, 55 insertions(+), 17 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs index 156712d..99f2f6e 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -76,31 +76,69 @@ /// </summary> void LoadEvent_LightDimming(DiyImageSeekBar dimmerControlBar) { - if (function.functionType == FunctionType.Dimmer || function.functionType == FunctionType.RGB) + //if (function.functionType == FunctionType.Dimmer || function.functionType == FunctionType.RGB) + //{ + // if (dimmerControlBar == null) + // return; + // var light = function as Light; + // dimmerControlBar.OnProgressChangedEvent += (sender, e) => + // { + // if ((DateTime.Now - light.refreshTime).TotalMilliseconds > 200)//璋冨厜鍛戒护鍙戦�侀棿闅斾簨浠� + // { + // new System.Threading.Thread(() => + // { + // light.refreshTime = DateTime.Now; + // light.brightness = e; + // Control.Send(CommandType_A.write, function); + // }) + // { IsBackground = true }.Start(); + // } + // }; + // dimmerControlBar.OnStopTrackingTouchEvent += (sender, e) => + // { + // light.brightness = dimmerControlBar.Progress; + // Control.Send(CommandType_A.write, function); + // }; + //} + if(function.functionType == FunctionType.Dimmer || function.functionType == FunctionType.RGB) { - if (dimmerControlBar == null) - return; - var light = function as Light; - dimmerControlBar.OnProgressChangedEvent += (sender, e) => - { - if ((DateTime.Now - light.refreshTime).TotalMilliseconds > 200)//璋冨厜鍛戒护鍙戦�侀棿闅斾簨浠� + dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => { + onDimmerBar = true; + }; + dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => { + onDimmerBar = false; + light.brightness = dimmerControlBar.Progress; + Control.Send(CommandType_A.write, light); + }; + dimmerControlBar.OnProgressChangedEvent = (sender, e) => { + light.brightness = e; + light.on_off = e > 0 ? "on" : "off"; + + if (e == 0 || e == 100) { - new System.Threading.Thread(() => + Control.Send(CommandType_A.write, light); + } + else + { + if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) { light.refreshTime = DateTime.Now; - light.brightness = e; - Control.Send(CommandType_A.write, function); - }) - { IsBackground = true }.Start(); + new System.Threading.Thread(() => + { + Control.Send(CommandType_A.write, light); + }) + { IsBackground = true }.Start(); + } + else + { + MainPage.Log("skip dimmer control!!"); + } } }; - dimmerControlBar.OnStopTrackingTouchEvent += (sender, e) => - { - light.brightness = dimmerControlBar.Progress; - Control.Send(CommandType_A.write, function); - }; + } + } #endregion -- Gitblit v1.8.0