From 6a8eb1ce9d8e34c50164a4e24e7098e681ee08b6 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 06 十一月 2023 15:08:06 +0800 Subject: [PATCH] 国际化支持:场景增加自动化使能配置 --- HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 224 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 140 insertions(+), 84 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs index ba10e47..96465f1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs @@ -1,7 +1,5 @@ 锘縰sing System; using System.Collections.Generic; -using HDL_ON.Common; -using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -209,31 +207,78 @@ attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) }); - btnSwitch = new Button() + var btnOn = new Button() { - Gravity = Gravity.CenterHorizontal, + X = Application.GetRealWidth(100), Y = Application.GetRealHeight(466), Width = Application.GetMinRealAverage(32), Height = Application.GetMinRealAverage(32), - UnSelectedImagePath = "Public/PowerClose.png", - SelectedImagePath = "Public/PowerOpen.png", + UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on.png", }; - controlView.AddChidren(btnSwitch); - btnSwitch.MouseUpEventHandler = (sender, e) => { - if (btnSwitch.IsSelected) - { - btnSwitch.IsSelected = false; - var d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, "off"); - function.Control(d); - } - else - { - btnSwitch.IsSelected = true; - var d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, "on"); - function.Control(d); - } + controlView.AddChidren(btnOn); + var btnOnText = new Button() + { + X = Application.GetRealWidth(100-9), + Y = Application.GetRealHeight(500), + Width = Application.GetMinRealAverage(50), + Height = Application.GetMinRealAverage(32), + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + TextID = StringId.Open, + }; + controlView.AddChidren(btnOnText); + + + var btnOff = new Button() + { + X = Application.GetRealWidth(180), + Y = Application.GetRealHeight(466), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off.png", + }; + controlView.AddChidren(btnOff); + var btnOffText = new Button() + { + X = Application.GetRealWidth(180 - 9), + Y = Application.GetRealHeight(500), + Width = Application.GetMinRealAverage(50), + Height = Application.GetMinRealAverage(32), + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + TextID = StringId.Close, + }; + controlView.AddChidren(btnOffText); + + + + btnOn.MouseUpEventHandler = (sender, e) => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, "on"); + function.Control(d); + }; + + btnOff.MouseUpEventHandler = (sender, e) => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, "off"); + function.Control(d); + }; + btnOnText.MouseUpEventHandler = (sender, e) => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, "on"); + function.Control(d); + }; + + btnOffText.MouseUpEventHandler = (sender, e) => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, "off"); + function.Control(d); }; @@ -267,21 +312,16 @@ btnSwitchIcon.MouseUpEventHandler = (sender, e) => { if (btnSwitchIcon.IsSelected) { - btnSwitchIcon.IsSelected = btnSwitch.IsSelected = false; var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.OnOff, "off"); function.Control(d); } else { - btnSwitchIcon.IsSelected = btnSwitch.IsSelected = true; var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.OnOff, "on"); function.Control(d); } - }; - btnSwitch.MouseUpEventHandler += (sender, e) => { - btnSwitchIcon.IsSelected = btnSwitch.IsSelected; }; } @@ -289,7 +329,6 @@ } - Button btnSwitch; /// <summary> /// 鍔犺浇璋冨厜灞炴�ц缃帶浠� @@ -337,23 +376,33 @@ }; dimmerView.AddChidren(btnBrightnessText); + dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + }; + dimmerBar.OnProgressChangedEvent = (sender, e) => { + return; if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) { var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, e.ToString()); + d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on"); function.Control(d); } else @@ -372,19 +421,6 @@ } - btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); - btnBrightnessText.Text = dimmerBar.Progress + "%"; - }; - - btnSwitch.MouseUpEventHandler += (sender, e) => { - if (btnSwitch.IsSelected) - { - dimmerBar.Progress = 100; - } - else - { - dimmerBar.Progress = 0; - } btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); btnBrightnessText.Text = dimmerBar.Progress + "%"; }; @@ -435,24 +471,34 @@ }; dimmerView.AddChidren(btnBrightnessText); + dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + }; + dimmerBar.OnProgressChangedEvent = (sender, e) => { + return; if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) { var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, e.ToString()); + d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on"); function.Control(d); } else @@ -475,19 +521,7 @@ btnBrightnessText.Text = dimmerBar.Progress + "%"; }; - btnSwitch.MouseUpEventHandler += (sender, e) => { - if (btnSwitch.IsSelected) - { - dimmerBar.Progress = 100; - } - else - { - dimmerBar.Progress = 0; - } - btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); - btnBrightnessText.Text = dimmerBar.Progress + "%"; - }; - + //attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); #region 鑹叉俯 @@ -666,7 +700,22 @@ }; colorPicker.ColorChaged += (sender2, e2) => { + if ( pointIsRight == false) + { + return; + } + //if (colorPicker.ColorImagePath == "FunctionIcon/Light/ColorWheelGray.png") + //{ + // return; + //} + if (function.refreshTime.AddMilliseconds(350) > DateTime.Now) + { + MainPage.Log("棰戠箒鎺у埗锛岄��鍑�"); + return; + } + function.refreshTime = DateTime.Now; rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString(); + btnCurColor.BackgroundColor = (uint)(0xFF000000 + rgbTemp.GetRGBcolor(rgbString)); var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.RGB, rgbString); @@ -677,9 +726,13 @@ pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); if (pointIsRight == false) { - //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐� + //pointIsRight:鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐� return; } + //if (colorPicker.ColorImagePath == "FunctionIcon/Light/ColorWheelGray.png") + //{ + // return; + //} //鏄剧ず鐧界偣 btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; @@ -694,8 +747,6 @@ //褰撻紶鏍囩偣涓嬩簨浠跺鐞� colorPicker.MouseDownEventHandler(sender, e); }; - - #region 浜害璋冭妭 var btnBrightnessText = new Button() @@ -742,24 +793,33 @@ }; controlView.AddChidren(dimmerBar); + dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + }; dimmerBar.OnProgressChangedEvent = (sender, e) => { + return; if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) { var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, e.ToString()); + d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on"); function.Control(d); } else @@ -776,11 +836,22 @@ { IsBackground = true }.Start(); } } - - - btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); - btnBrightnessText.Text = dimmerBar.Progress + "%"; + //if (e == 0) + //{ + // if (colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png") + // { + // colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; + // } + //} + //else + //{ + // if (colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png") + // { + // colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png"; + // } + //} }; + var btnMaxValuesText = new Button() @@ -796,16 +867,6 @@ }; controlView.AddChidren(btnMaxValuesText); - btnSwitch.MouseUpEventHandler += (sender, e) => { - if (btnSwitch.IsSelected) - { - dimmerBar.Progress = 100; - } - else - { - dimmerBar.Progress = 0; - } - }; #endregion int heightMore = 375 - magriHeight-20; @@ -895,7 +956,7 @@ //6500K var btnTempClolorMax = new Button(); btnTempClolorMax.Y = btnTempClolorMin.Y; - btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30); + btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(15); btnTempClolorMax.Width = Application.GetRealWidth(54); btnTempClolorMax.Height = Application.GetRealHeight(21); btnTempClolorMax.Text = "6500K"; @@ -906,9 +967,7 @@ #endregion - heightMore = 70; - } if (hadColorful) @@ -979,8 +1038,7 @@ function.SetAttrState(FunctionAttributeKey.Colorful, controlColorfulState); var d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.Colorful, controlColorfulState); - - Control.Ins.SendWriteCommand(function, d); + function.Control(d); } catch (Exception ex) { @@ -991,8 +1049,6 @@ }; #endregion - - } -- Gitblit v1.8.0