From 762eed3a31840aa91ac508c63b8df54029cf0262 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 18 七月 2023 16:48:12 +0800 Subject: [PATCH] 炫彩功能优化 --- HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 58 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 43 insertions(+), 15 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index b6d04cf..e92f3e5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -49,6 +50,11 @@ /// 鑹茬洏閲岄潰閭d釜浼氭粦鍔ㄧ殑鐞� /// </summary> Button btnWhiteRound; + /// <summary> + /// 鐐僵寮�鍏虫寜閽� + /// </summary> + Button btnColorfulSwitch; + #endregion #region 鍖哄煙鍙橀噺 @@ -228,7 +234,7 @@ dimmerBar = new DiyImageSeekBar() { X = Application.GetRealWidth(35 + 22), - Y = Application.GetRealHeight(312 - magriHeight), + Y = Application.GetRealHeight(316 - magriHeight), Width = Application.GetRealWidth(210), Height = Application.GetRealHeight(54), SeekBarViewHeight = Application.GetRealHeight(8), @@ -279,7 +285,7 @@ var btnGradualChangeMinValuesText = new Button() { X = Application.GetRealWidth(35), - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), + Y = btnGradualChangeText.Bottom,// + Application.GetRealHeight(10), Width = Application.GetRealWidth(22), Height = Application.GetRealHeight(21), Text = "0s", @@ -317,7 +323,7 @@ var btnGradualChangeMaxValuesText = new Button() { X = barFadeTime.Right, - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), + Y = btnGradualChangeText.Bottom,// + Application.GetRealHeight(10), Width = Application.GetRealWidth(35), Height = Application.GetRealHeight(21), Text = "10s", @@ -329,7 +335,7 @@ }; controlView.AddChidren(btnGradualChangeMaxValuesText); #endregion - heightMore = 70; + //heightMore += 70; } @@ -337,10 +343,11 @@ { #region 鐐僵鍔熻兘 + var btnGradualChangeText = new Button() { X = Application.GetRealWidth(35), - Y = Application.GetRealHeight(375+ heightMore- magriHeight), + Y = Application.GetRealHeight(heightMore + magriHeight), Width = Application.GetRealWidth(224), Height = Application.GetRealHeight(21), TextAlignment = TextAlignment.CenterLeft, @@ -350,16 +357,16 @@ }; controlView.AddChidren(btnGradualChangeText); - var btnGradualChangeMinValuesText = new Button() + var btnEditColorful = new Button() { X = Application.GetRealWidth(35), - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), + Y = btnGradualChangeText.Bottom,// + Application.GetRealHeight(10), Width = Application.GetRealWidth(22), Height = Application.GetRealHeight(21), UnSelectedImagePath = "Public/Edit.png", }; - controlView.AddChidren(btnGradualChangeMinValuesText); - btnGradualChangeMinValuesText.MouseUpEventHandler = (sender, e) => { + controlView.AddChidren(btnEditColorful); + btnEditColorful.MouseUpEventHandler = (sender, e) => { var rgbView = new ColorfulInfoPage(function); MainPage.BasePageView.AddChidren(rgbView); rgbView.LoadPage(); @@ -368,23 +375,44 @@ var barColorful = new FrameLayout() { - X = btnGradualChangeMinValuesText.Right + Application.GetRealWidth(15), - Y = Application.GetRealHeight(412 + heightMore-magriHeight), + X = btnEditColorful.Right + Application.GetRealWidth(15), + Y = Application.GetRealHeight(27 + heightMore + magriHeight), Width = Application.GetRealWidth(180), Height = Application.GetRealHeight(8), BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png", }; controlView.AddChidren(barColorful); - var btnGradualChangeMaxValuesText = new Button() + btnColorfulSwitch = new Button() { X = barColorful.Right + Application.GetRealWidth(8), - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), + Y = btnGradualChangeText.Bottom,// + Application.GetRealHeight(10), Width = Application.GetRealWidth(38), Height = Application.GetRealHeight(24), - UnSelectedImagePath = "Public/Switch.png" + UnSelectedImagePath = "Public/Switch.png", + SelectedImagePath = "Public/SwitchOn.png", }; - controlView.AddChidren(btnGradualChangeMaxValuesText); + controlView.AddChidren(btnColorfulSwitch); + + btnColorfulSwitch.MouseUpEventHandler = (sender, e) => { + btnColorfulSwitch.IsSelected = !btnColorfulSwitch.IsSelected; + new System.Threading.Thread(() => + { + try + { + var controlColorfulState = btnColorfulSwitch.IsSelected ? "on" : "off"; + function.SetAttrState(FunctionAttributeKey.Colorful, controlColorfulState); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Colorful, controlColorfulState); + Control.Ins.SendWriteCommand(function, d); + }catch(Exception ex) + { + MainPage.Log($"鎺у埗鐐僵寮�鍏冲紓甯�:{ex.Message}"); + } + }) + { IsBackground = true }.Start(); + }; + #endregion -- Gitblit v1.8.0