From c96d59d6b6379acb0fd899ad2e255a121ee6c8c6 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 18 十二月 2020 10:45:20 +0800 Subject: [PATCH] 20201218-1 --- HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index aeec41e..b866713 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -19,13 +19,24 @@ return; if (uFunction.functionType == bodyView.light.functionType && uFunction.sid == bodyView.light.sid) { - if (!bodyView.onDimmerBar) + + if (uFunction.trait_on_off.curValue.ToString() == "on") { - bodyView.dimmerBar.Progress = uFunction.brightness; + bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png"; + bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; + bodyView.btnSwitch.IsSelected = true; + bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); + if (!bodyView.onDimmerBar) + { + bodyView.dimmerBar.Progress = uFunction.brightness; + } } - bodyView.dimmerBar.ProgressBarColor = uFunction.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.AuxiliaryColor1 : CSS.CSS_Color.PromptingColor2; - bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on"; - bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); + else + { + bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; + bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.PromptingColor2; + bodyView.btnSwitch.IsSelected = false; + } } } catch (Exception ex) @@ -59,6 +70,10 @@ { DateTime colorChangeTime = DateTime.MinValue; colorPicker.ColorChaged += (sender2, e2) => { + if(light.trait_on_off.curValue.ToString() == "off") + { + return; + } if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200) { light.SetRGBcolor(e2); @@ -98,13 +113,16 @@ onDimmerBar = true; }; dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { - onDimmerBar = false; + new System.Threading.Thread(() => { + System.Threading.Thread.Sleep(100); + onDimmerBar = false; + }) + { IsBackground = true }.Start(); light.brightness = dimmerBar.Progress; 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; - //Control.Send(CommandType_A.write, light); }; dimmerBar.OnProgressChangedEvent = (sender, e) => { light.fadeTime = 0; @@ -150,9 +168,9 @@ /// </summary> void LoadEvet_ChangeFadeTime() { - barFadeTime.OnProgressChangedEvent = (sender, e) => + barFadeTime.MouseUpEventHandler = (sender, e) => { - light.fadeTime = e; + light.fadeTime = barFadeTime.Progress; light.SaveFunctionData(true); }; } @@ -170,6 +188,14 @@ light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); + if (btnSwitch.IsSelected) + { + d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); + } + else + { + light.lastBrightness = light.brightness; + } Control.Ins.SendWriteCommand(light, d); }) { IsBackground = true }.Start(); -- Gitblit v1.8.0