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/ColorfulSettingPage.cs |   55 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
index fdf6d44..60ce741 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
@@ -11,11 +12,17 @@
 
         Action<uint> backAction;
         public uint curColor = 0;
-
-        public ColorfulSettingPage(Action<uint> action)
+        bool isSatrtColor = false;
+        byte redColor = 0;
+        byte greenColor = 0;
+        byte blueColor = 0;
+        Function function;
+        public ColorfulSettingPage(Function device, Action<uint> action,bool isStart)
         {
             bodyView = this;
+            function = device;
             backAction = action;
+            isSatrtColor = isStart;
         }
 
         public void LoadPage(string curColorString)
@@ -24,14 +31,12 @@
 
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(()=> {
-                backAction?.Invoke(curColor) ;
             });
-
 
             var contentView = new VerticalScrolViewLayout()
             {
                 Y = Application.GetRealHeight(64+34),
-                Height = Application.GetRealHeight(500),
+                Height = Application.GetRealHeight(570),
                 ScrollEnabled = false,
             };
             bodyView.AddChidren(contentView);
@@ -96,7 +101,6 @@
 
 
             #endregion
-
 
             #region 鎺ㄨ崘
             var recommendView = new FrameLayout()
@@ -208,7 +212,6 @@
 
             #endregion
 
-
             #region 褰撳墠棰滆壊
             var curColorView = new FrameLayout()
             {
@@ -308,11 +311,43 @@
 
             #endregion
 
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(30)
+            });
+
+            #region 淇濆瓨
+            var btnConfrim = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(220),
+                Height = Application.GetRealHeight(44),
+                Radius = (uint)Application.GetRealHeight(22),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.MainBackgroundColor,
+                BackgroundColor = CSS_Color.MainColor,
+                TextID = StringId.Save,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+            };
+            contentView.AddChidren(btnConfrim);
+            btnConfrim.MouseUpEventHandler = (sender, e) =>
+            {
+                backAction?.Invoke(curColor) ;
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                if (isSatrtColor)
+                    d.Add(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor);
+                else
+                    d.Add(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor);
+                Control.Ins.SendWriteCommand(function, d);
+            };
+
+
+            #endregion
 
             colorPicker.ColorChaged += (sender2, color) => {
-                byte redColor = color[0];
-                byte greenColor = color[1];
-                byte blueColor = color[2];
+                 redColor = color[0];
+                 greenColor = color[1];
+                 blueColor = color[2];
 
                 int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor;
 

--
Gitblit v1.8.0