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 | 651 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 523 insertions(+), 128 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs index 5ecba87..a8048f1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs @@ -31,8 +31,15 @@ } } + public override void RemoveFromParent() + { + base.RemoveFromParent(); + } + public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) { + bodyView.RemoveAll(); + btnCollection_Out = btnCollectionIcon; btnFunctionName_Out = btnFunctionNameOut; btnFromFloor_Out = btnFromFloorOut; @@ -41,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", @@ -90,10 +97,8 @@ // function.CollectFunction(); //}; - - //鍥為��鍒锋柊淇℃伅浜嬩欢 - new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_SettingIcon( () => { + new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => { var page = new AddGroupControlPage(function, (newGC) => { try @@ -102,9 +107,22 @@ { if (newGC != null) { - btnFunctionName.Text = btnFunctionName_Out.Text = function.name; - function.roomIds = newGC.uids; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = newGC.GetUidListName(); + var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId); + if(localTemp!= null) + { + try + { + localTemp.sids = newGC.sids; + localTemp.name = newGC.name; + localTemp.roomIds = newGC.roomIds; + localTemp.uids = newGC.uids; + } + catch { } + function = newGC; + btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = function.GetRoomListName(); + LoadPage(btnCollection, btnFunctionName, btnFunctionName); + } } }); } @@ -116,7 +134,7 @@ try { this.RemoveFromParent(); - UI.HomePage.RefreshFunctionView(); + UI.HomePage.RefreshGroupControlView(); UI.RoomPage.bodyView?.ReLoadPage(); UI.FunctionPage.bodyView?.ReLoadPage(); } @@ -157,10 +175,12 @@ } } hadRGB = true; + hadDimming = true; } else if (temp.spk == SPK.LightCCT) { hadCCT = true; + hadDimming = true; } else if (temp.spk == SPK.LightDimming) { @@ -174,63 +194,143 @@ } //灞炴�ц缃尯鍩� - var attrView = new VerticalScrolViewLayout() + VerticalScrolViewLayout attrView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(52), Width = Application.GetRealWidth(343), ScrollEnabled = false, }; - //灞炴�ц缃尯鍩熼珮搴� - int attrViewHight = Application.GetRealHeight(18 + 22); - - controlView.AddChidren(attrView); + attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) }); + + var btnOn = new Button() + { + X = Application.GetRealWidth(100), + Y = Application.GetRealHeight(466), + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on.png", + }; + 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) { - hadCCT = true; - 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); } - - - - - var btnSwitch = new Button() + else { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(466), - Width = Application.GetMinRealAverage(32), - Height = Application.GetMinRealAverage(32), - UnSelectedImagePath = "Public/PowerClose.png", - SelectedImagePath = "Public/PowerOpen.png", - }; - controlView.AddChidren(btnSwitch); - btnSwitch.MouseUpEventHandler = (sender, e) => { - if (btnSwitch.IsSelected) + attrView.AddChidren(new Button() { Height = Application.GetRealHeight(30) }); + var btnSwitchIcon = new Button() { - 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); - } - }; + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(102), + Width = Application.GetRealWidth(168), + Height = Application.GetRealWidth(288), + UnSelectedImagePath = "FunctionIcon/Light/RelayBg.png", + SelectedImagePath = "FunctionIcon/Light/RelayOnBg.png", + IsSelected = function.trait_on_off.curValue.ToString() == "on" + }; + attrView.AddChidren(btnSwitchIcon); + + btnSwitchIcon.MouseUpEventHandler = (sender, e) => { + btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; + if (btnSwitchIcon.IsSelected) + { + 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); + } + }; + + btnOn.MouseUpEventHandler += (sender, e) => { + btnSwitchIcon.IsSelected = true; + }; + btnOff.MouseUpEventHandler += (sender, e) => { + btnSwitchIcon.IsSelected = false; + }; + } + + } @@ -239,97 +339,210 @@ /// 鍔犺浇璋冨厜灞炴�ц缃帶浠� /// </summary> /// <param name="attrView"></param> - void LoadDimmingAttrView(VerticalScrolViewLayout attrView) + void LoadDimmingAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) { - var dimmingView = new FrameLayout() - { - Height = Application.GetRealHeight(54 + 11) - }; - attrView.AddChidren(dimmingView); - #region 浜害璋冭妭 + + + attrView.AddChidren(new Button + { + Height = Application.GetRealHeight(50), + }); + + var dimmerView = new FrameLayout() + { + Height = Application.GetRealHeight(280) + }; + attrView.AddChidren(dimmerView); + + var dimmerBar = new WaveSeekBarOn() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(168 - 40), + Height = Application.GetRealHeight(288 - 16 - 16), + BorderColor = 0x00000000, + CornerRadius = Application.GetRealWidth(30), + BorderWidth = 0, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), + IsProgressTextShow = false, + }; + dimmerView.AddChidren(dimmerBar); + var btnBrightnessText = new Button() { - X = Application.GetRealWidth(35), - Y = Application.GetRealHeight(1), - Width = Application.GetRealWidth(224), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.CenterLeft, + Gravity = Gravity.CenterHorizontal, + Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100), + Width = Application.GetRealWidth(56), + Height = Application.GetRealWidth(46), + UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png", TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextID = StringId.Brightness, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%", }; - btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + function.GetAttrState(FunctionAttributeKey.Brightness) + "%"; - dimmingView.AddChidren(btnBrightnessText); + dimmerView.AddChidren(btnBrightnessText); - - var btnMinValuesText = new Button() - { - X = Application.GetRealWidth(35), - Y = btnBrightnessText.Bottom, - Width = Application.GetRealWidth(40), - Height = Application.GetRealHeight(21), - Text = "0%", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + 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(); }; - dimmingView.AddChidren(btnMinValuesText); - var dimmerBar = new DiyImageSeekBar() - { - X = Application.GetRealWidth(45 + 10), - Y = Application.GetRealHeight(11), - Width = Application.GetRealWidth(220), - Height = Application.GetRealHeight(54), - SeekBarViewHeight = Application.GetRealHeight(8), - ThumbImagePath = "Public/ThumbImage.png", - ThumbImageHeight = Application.GetRealHeight(54), - ProgressTextColor = CSS_Color.FirstLevelTitleColor, - ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, - ProgressBarColor = CSS_Color.AuxiliaryColor1, - MaxValue = 100, - SeekBarPadding = Application.GetRealWidth(20), - IsProgressTextShow = false, - ProgressChangeDelayTime = 0, - }; - dimmingView.AddChidren(dimmerBar); dimmerBar.OnProgressChangedEvent = (sender, e) => { - btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; - }; - dimmerBar.OnStopTrackingTouchEvent = (sender, e) => - { - btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; - var d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Brightness, e.ToString()); - function.Control(d); + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + return; + if (e == 0 && lastBrightness != 0) + { + lastBrightness = 0; + } + else + { + if (lastBrightness == 0) + lastBrightness = e; + } + 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 + { + if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) + { + function.refreshTime = DateTime.Now; + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + } + } + }; - var btnMaxValuesText = new Button() - { - X = dimmerBar.Right, - Y = btnBrightnessText.Bottom, - Width = Application.GetRealWidth(55), - Height = Application.GetRealHeight(21), - Text = "100%", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + + btnOn.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 100; + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; }; - dimmingView.AddChidren(btnMaxValuesText); - #endregion + btnOff.MouseUpEventHandler += (sender, e) => { + dimmerBar.Progress = 0; + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); + btnBrightnessText.Text = dimmerBar.Progress + "%"; + }; + } + int lastBrightness = 0; /// <summary> /// 鍔犺浇cct灞炴�ц缃帶浠� /// </summary> /// <param name="attrView"></param> - void LoadCctAttrView(VerticalScrolViewLayout attrView) + void LoadCctAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) { + attrView.AddChidren(new Button + { + Height = Application.GetRealHeight(20), + }); + + var dimmerView = new FrameLayout() + { + Height = Application.GetRealHeight(280) + }; + attrView.AddChidren(dimmerView); + + var dimmerBar = new WaveSeekBarOn() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(168 - 40), + Height = Application.GetRealHeight(288 - 16 - 16), + BorderColor = 0x00000000, + CornerRadius = Application.GetRealWidth(30), + BorderWidth = 0, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), + IsProgressTextShow = false, + }; + dimmerView.AddChidren(dimmerBar); + + var btnBrightnessText = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100), + Width = Application.GetRealWidth(56), + Height = Application.GetRealWidth(46), + UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png", + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%", + }; + 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) + { + lastBrightness = 0; + } + else + { + if (lastBrightness == 0) + lastBrightness = e; + } + + 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 + { + if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) + { + function.refreshTime = DateTime.Now; + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + } + } + + + }; + + + //attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); + #region 鑹叉俯 var cctView = new FrameLayout() { @@ -385,6 +598,7 @@ Y = Application.GetRealHeight(11), Width = Application.GetRealWidth(220), Height = Application.GetRealHeight(54), + Progress = 38, }; barColorTemplatrue.MinValue = 27; barColorTemplatrue.MaxValue = 65; @@ -421,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; @@ -490,6 +720,69 @@ btnWhiteRound.Visible = false; framePickerBack.AddChidren(btnWhiteRound); + + //褰撳墠鐐瑰嚮鐨勩�愮偣銆戞槸鍚︽纭� + bool pointIsRight = false; + //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�) + int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); + string rgbString = "255,255,255"; + var rgbTemp = new Light(); + colorPicker.MouseUpEventHandler = (sender2, e2) => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.RGB, rgbString); + function.Control(d); + }; + 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); + function.Control(d); + }; + colorPicker.MouseDownEventHandler += (sender, e) => + { + 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; + if (btnWhiteRound.Visible == false) + { + btnWhiteRound.Visible = true; + } + }; + + colorPicker.MouseMoveEventHandler += (sender, e) => + { + //褰撻紶鏍囩偣涓嬩簨浠跺鐞� + colorPicker.MouseDownEventHandler(sender, e); + }; + #region 浜害璋冭妭 var btnBrightnessText = new Button() { @@ -535,6 +828,69 @@ }; 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) + { + lastBrightness = 0; + } + else + { + if (lastBrightness == 0) + lastBrightness = e; + } + 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 + { + if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) + { + function.refreshTime = DateTime.Now; + new System.Threading.Thread(() => + { + var d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + function.Control(d); + }) + { IsBackground = true }.Start(); + } + } + //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() { X = dimmerBar.Right, @@ -547,6 +903,7 @@ TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; controlView.AddChidren(btnMaxValuesText); + #endregion int heightMore = 375 - magriHeight-20; @@ -612,6 +969,7 @@ }; barColorTemplatrue.MinValue = 27; barColorTemplatrue.MaxValue = 65; + barColorTemplatrue.Progress = 38; barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑 barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000; barColorTemplatrue.SeekBarBackgroundColor = 0x00000000; @@ -635,7 +993,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"; @@ -646,9 +1004,7 @@ #endregion - heightMore = 70; - } if (hadColorful) @@ -658,7 +1014,7 @@ var btnGradualChangeText = new Button() { X = Application.GetRealWidth(35), - Y = Application.GetRealHeight(375 + heightMore - magriHeight), + Y = hadCCT ? Application.GetRealHeight(375 + heightMore - magriHeight) : Application.GetRealHeight(heightMore+10), Width = Application.GetRealWidth(224), Height = Application.GetRealHeight(21), TextAlignment = TextAlignment.CenterLeft, @@ -668,16 +1024,17 @@ }; controlView.AddChidren(btnGradualChangeText); - var btnGradualChangeMinValuesText = new Button() + var btnColorfulEdit = new Button() { X = Application.GetRealWidth(35), Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), Width = Application.GetRealWidth(22), Height = Application.GetRealHeight(21), UnSelectedImagePath = "Public/Edit.png", + Visible = false, }; - controlView.AddChidren(btnGradualChangeMinValuesText); - btnGradualChangeMinValuesText.MouseUpEventHandler = (sender, e) => { + controlView.AddChidren(btnColorfulEdit); + btnColorfulEdit.MouseUpEventHandler = (sender, e) => { var rgbView = new ColorfulInfoPage(function); MainPage.BasePageView.AddChidren(rgbView); rgbView.LoadPage(); @@ -686,29 +1043,63 @@ var barColorful = new FrameLayout() { - X = btnGradualChangeMinValuesText.Right + Application.GetRealWidth(15+5), - Y = Application.GetRealHeight(412 + heightMore - magriHeight), + X = btnColorfulEdit.Right + Application.GetRealWidth(15 + 5), Width = Application.GetRealWidth(170), + //X = Application.GetRealWidth(35), + //Width = Application.GetRealWidth(170 + 41), + Y = hadCCT ? Application.GetRealHeight(412 + heightMore - magriHeight) : Application.GetRealHeight(heightMore + 50), Height = Application.GetRealHeight(8), BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png", }; controlView.AddChidren(barColorful); - var btnGradualChangeMaxValuesText = new Button() + var btnColorfulSwitch = new Button() { X = barColorful.Right + Application.GetRealWidth(8), Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), Width = Application.GetRealWidth(38), Height = Application.GetRealHeight(24), - UnSelectedImagePath = "Public/Switch.png" + UnSelectedImagePath = "Public/Switch.png", + SelectedImagePath = "Public/SwitchOn.png" }; - controlView.AddChidren(btnGradualChangeMaxValuesText); + controlView.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); + function.Control(d); + } + catch (Exception ex) + { + MainPage.Log($"鎺у埗鐐僵寮�鍏冲紓甯�:{ex.Message}"); + } + }) + { IsBackground = true }.Start(); + }; + #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 + "%"; + }; + + } @@ -742,5 +1133,9 @@ return false; } + + + + } } -- Gitblit v1.8.0