From ee736e5d594e973e63e85647caa03cf635c8867f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 20 七月 2023 10:42:21 +0800
Subject: [PATCH] 增加视频门锁电池管理说明页面

---
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs |   68 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
index 63cd333..2fd1ff6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
@@ -41,6 +41,74 @@
             };
             bodyView.AddChidren(contentView);
 
+            #region 鐐僵寮�鍏�
+            contentView.AddChidren(new Button
+            {
+                Height = Application.GetRealHeight(10),
+                BackgroundColor = CSS_Color.BackgroundColor,
+            });
+
+            var viewSwitch = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            contentView.AddChidren(viewSwitch);
+
+            var btnSwitchText = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.ColorfulFunction,
+            };
+            viewSwitch.AddChidren(btnSwitchText);
+
+            var btnColorfulSwitch = new Button()
+            {
+                X = Application.GetRealWidth(314),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(48),
+                Height = Application.GetMinRealAverage(36),
+                UnSelectedImagePath = "Public/Switch.png",
+                SelectedImagePath = "Public/SwitchOn.png",
+                IsSelected = function.GetAttrState(FunctionAttributeKey.Colorful) == "on"
+            };
+            viewSwitch.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);
+                        var d = new Dictionary<string, string>();
+                        d.Add(FunctionAttributeKey.Colorful, controlColorfulState);
+                        if (controlColorfulState == "on")
+                        {
+                            var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(",");
+                            var sendColorString = color[0] + "," + color[1] + "," + color[2];
+                            d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString);
+                            color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(",");
+                            sendColorString = color[0] + "," + color[1] + "," + color[2];
+                            d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString);
+                            d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime));
+                        }
+                        Control.Ins.SendWriteCommand(function, d);
+                    }
+                    catch (Exception ex)
+                    {
+                        MainPage.Log($"鎺у埗鐐僵寮�鍏冲紓甯�:{ex.Message}");
+                    }
+                })
+                { IsBackground = true }.Start();
+            };
+
+            #endregion
+
             #region 璧峰棰滆壊
             var startView = new FrameLayout()
             {

--
Gitblit v1.8.0