From 3fcb73db484d2bed5ee993702913a7eaea68068c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 18 八月 2023 18:01:23 +0800 Subject: [PATCH] 2.1.2 --- HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 190 ++++++++++++++++++++++++----------------------- 1 files changed, 97 insertions(+), 93 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs index f51e8a3..4a05b7c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs @@ -4,6 +4,7 @@ using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; +using Java.Util.Functions; using Shared; namespace HDL_ON.UI @@ -209,31 +210,39 @@ 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", + UnSelectedImagePath = "Public/PowerOpen.png", + }; + controlView.AddChidren(btnOn); + + var btnOff = new Button() + { + X = Application.GetRealWidth(180), Y = Application.GetRealHeight(466), Width = Application.GetMinRealAverage(32), Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "Public/PowerClose.png", - SelectedImagePath = "Public/PowerOpen.png", + //UnSelectedImagePath = "Public/PowerOpen.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(btnOff); + 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); }; @@ -267,21 +276,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 +293,6 @@ } - Button btnSwitch; /// <summary> /// 鍔犺浇璋冨厜灞炴�ц缃帶浠� @@ -337,18 +340,26 @@ }; 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) => { if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) { @@ -373,19 +384,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 + "%"; }; @@ -436,18 +434,26 @@ }; 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) => { if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) @@ -477,19 +483,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 鑹叉俯 @@ -628,10 +622,10 @@ ColorImagePath = "FunctionIcon/Light/ColorWheel.png", }; framePickerBack.AddChidren(colorPicker); - if (function.trait_on_off.curValue.ToString() == "off") - { - colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; - } + //if (function.trait_on_off.curValue.ToString() == "off") + //{ + // colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; + //} //colorPicker.MouseDownEventHandler = (sender, e) => { // MainPage.BasePageView.ScrollEnabled = false; //}; @@ -668,7 +662,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,12 +686,15 @@ colorPicker.MouseDownEventHandler += (sender, e) => { pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); - if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) + 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; @@ -743,19 +755,26 @@ }; 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) => { if (e == 0 && lastBrightness != 0) { - btnSwitch.IsSelected = false; lastBrightness = 0; } else { if (lastBrightness == 0) lastBrightness = e; - btnSwitch.IsSelected = true; } if (e == 0 || e == 100) { @@ -778,23 +797,22 @@ { IsBackground = true }.Start(); } } - if (e == 0) - { - if (function.trait_on_off.curValue.ToString() == "on") - { - function.SetAttrState(FunctionAttributeKey.OnOff, "off"); - colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; - } - } - else - { - if (function.trait_on_off.curValue.ToString() == "off") - { - function.SetAttrState(FunctionAttributeKey.OnOff, "on"); - colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png"; - } - } + //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() @@ -810,20 +828,6 @@ }; controlView.AddChidren(btnMaxValuesText); - btnSwitch.MouseUpEventHandler += (sender, e) => { - if (btnSwitch.IsSelected) - { - dimmerBar.Progress = 100; - function.SetAttrState(FunctionAttributeKey.OnOff, "on"); - colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png"; - } - else - { - dimmerBar.Progress = 0; - function.SetAttrState(FunctionAttributeKey.OnOff, "off"); - colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; - } - }; #endregion int heightMore = 375 - magriHeight-20; -- Gitblit v1.8.0