From 917c28d31963e893d7dd26f933adfa3bde3cf260 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 26 七月 2023 15:54:29 +0800 Subject: [PATCH] feature 门锁不支持一键开锁设备按钮置灰&&门锁呼叫 --- HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs | 84 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 79 insertions(+), 5 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs index 8b683de..2fd1ff6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs @@ -1,6 +1,7 @@ 锘� using System; using System.Collections.Generic; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.Stan; using HDL_ON.UI.CSS; @@ -39,6 +40,74 @@ ScrollEnabled = false, }; 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() @@ -88,7 +157,7 @@ btnStartColor.BackgroundColor = color; function.SetAttrState(FunctionAttributeKey.ColorfulBegin, color); }; - var rgbView = new ColorfulSettingPage(action); + var rgbView = new ColorfulSettingPage(function, action,true); MainPage.BasePageView.AddChidren(rgbView); rgbView.LoadPage(function.GetAttrState(FunctionAttributeKey.ColorfulBegin)); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -134,7 +203,7 @@ Radius = (uint)Application.GetRealWidth(14), BorderColor = CSS_Color.DividingLineColor, BorderWidth = 1, - BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.ColorfulBegin))) + BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.ColorfulEnd))) }; endColorView.AddChidren(btnEndColor); @@ -145,7 +214,7 @@ btnEndColor.BackgroundColor = color; function.SetAttrState(FunctionAttributeKey.ColorfulEnd, color); }; - var rgbView = new ColorfulSettingPage(action); + var rgbView = new ColorfulSettingPage(function, action,false); MainPage.BasePageView.AddChidren(rgbView); rgbView.LoadPage(function.GetAttrState(FunctionAttributeKey.ColorfulEnd)); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -155,7 +224,7 @@ #endregion - #region 宸ヤ綔鏃堕暱 + #region 鐐僵鍛ㄦ湡 var workHoursView = new FrameLayout() { Height = Application.GetRealHeight(50), @@ -213,6 +282,11 @@ btnWorkHours.Text = hour + "鏃�"; btnWorkHours.Text += minute + "鍒�"; btnWorkHours.Text += second + "绉�"; + new System.Threading.Thread(() => { + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.ColorfulTime, (hour * 360 + minute * 60 + second).ToString()); + Control.Ins.SendWriteCommand(function, d); + }) { IsBackground = true }.Start(); }); }); } @@ -307,7 +381,7 @@ Height = Application.GetRealHeight(210), Radius = (uint)Application.GetRealWidth(12), }; - for (int i = 0; i <= 23; i += 1) + for (int i = 0; i <= 15; i += 1) { item1.Add(i+Language.StringByID(StringId.h)); } -- Gitblit v1.8.0