From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:25:59 +0800 Subject: [PATCH] 2024年07月25日17:24:45 --- HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 315 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 203 insertions(+), 112 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..a8048f1 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; @@ -50,7 +48,7 @@ controlView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(88), + Y = Application.GetRealHeight(88 + 10), Width = Application.GetRealWidth(327), Height = Application.GetRealHeight(526), BackgroundImagePath = "Public/Fragmentbg.png", @@ -98,9 +96,6 @@ // btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; // function.CollectFunction(); //}; - - - //鍥為��鍒锋柊淇℃伅浜嬩欢 new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => { @@ -209,45 +204,92 @@ 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(495), + 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(495), + 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); }; if (hadRGB) { - LoadRgbAttrView(hadCCT,hadColorful); + LoadRgbAttrView(hadCCT,hadColorful,btnOn,btnOff); } else if (hadCCT) { - LoadCctAttrView(attrView); + LoadCctAttrView(attrView, btnOn, btnOff); } else if (hadDimming) { - LoadDimmingAttrView(attrView); + LoadDimmingAttrView(attrView, btnOn, btnOff); } else { @@ -265,23 +307,26 @@ attrView.AddChidren(btnSwitchIcon); btnSwitchIcon.MouseUpEventHandler = (sender, e) => { + btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; 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); } + else + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, "off"); + function.Control(d); + } }; - btnSwitch.MouseUpEventHandler += (sender, e) => { - btnSwitchIcon.IsSelected = btnSwitch.IsSelected; + + btnOn.MouseUpEventHandler += (sender, e) => { + btnSwitchIcon.IsSelected = true; + }; + btnOff.MouseUpEventHandler += (sender, e) => { + btnSwitchIcon.IsSelected = false; }; } @@ -289,13 +334,12 @@ } - Button btnSwitch; /// <summary> /// 鍔犺浇璋冨厜灞炴�ц缃帶浠� /// </summary> /// <param name="attrView"></param> - void LoadDimmingAttrView(VerticalScrolViewLayout attrView) + void LoadDimmingAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) { @@ -337,18 +381,30 @@ }; 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) => { + + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + 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) { @@ -372,23 +428,21 @@ } } + }; + + + btnOn.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 100; + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + btnOff.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 0; 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 + "%"; - }; } int lastBrightness = 0; @@ -397,7 +451,7 @@ /// 鍔犺浇cct灞炴�ц缃帶浠� /// </summary> /// <param name="attrView"></param> - void LoadCctAttrView(VerticalScrolViewLayout attrView) + void LoadCctAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) { attrView.AddChidren(new Button { @@ -436,18 +490,29 @@ }; 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) => { + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + 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) @@ -473,23 +538,9 @@ } - 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 + "%"; - }; - + //attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); #region 鑹叉俯 @@ -584,13 +635,29 @@ cctView.AddChidren(btnTempClolorMax); #endregion + + + + + btnOn.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 100; + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + btnOff.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 0; + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + + } /// <summary> /// 鍔犺浇rgb灞炴�ц缃帶浠� /// </summary> /// <param name="attrView"></param> - void LoadRgbAttrView(bool hadCCT,bool hadColorful) + void LoadRgbAttrView(bool hadCCT,bool hadColorful,Button btnOn,Button btnOff) { Light lightTemp = new Light(); int magriHeight = 0; @@ -628,10 +695,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 +735,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 +759,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 +828,29 @@ }; 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) => { + //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + //btnBrightnessText.Text = dimmerBar.Progress + "%"; + 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) { @@ -778,23 +873,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 +904,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; @@ -1008,6 +1088,17 @@ #endregion } + btnOn.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 100; + //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + //btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + btnOff.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 0; + //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + //btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + } -- Gitblit v1.8.0