| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | |
| | | Action<uint> backAction; |
| | | public uint curColor = 0; |
| | | |
| | | public ColorfulSettingPage(Action<uint> action) |
| | | bool isSatrtColor = false; |
| | | byte redColor = 0; |
| | | byte greenColor = 0; |
| | | byte blueColor = 0; |
| | | Function function; |
| | | public ColorfulSettingPage(Function device, Action<uint> action,bool isStart) |
| | | { |
| | | bodyView = this; |
| | | function = device; |
| | | backAction = action; |
| | | isSatrtColor = isStart; |
| | | } |
| | | |
| | | public void LoadPage(string curColorString) |
| | |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(()=> { |
| | | backAction?.Invoke(curColor) ; |
| | | }); |
| | | |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64+34), |
| | | Height = Application.GetRealHeight(500), |
| | | Height = Application.GetRealHeight(570), |
| | | ScrollEnabled = false, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 推荐 |
| | | var recommendView = new FrameLayout() |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 当前颜色 |
| | | var curColorView = new FrameLayout() |
| | | { |
| | |
| | | |
| | | #endregion |
| | | |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(30) |
| | | }); |
| | | |
| | | #region 保存 |
| | | var btnConfrim = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextID = StringId.Save, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | contentView.AddChidren(btnConfrim); |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | backAction?.Invoke(curColor) ; |
| | | var d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | if (isSatrtColor) |
| | | { |
| | | d.Add(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); |
| | | function.SetAttrState(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); |
| | | //var color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(","); |
| | | //var sendColorString = color[0] + "," + color[1] + "," + color[2]; |
| | | //d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString); |
| | | //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); |
| | | } |
| | | else |
| | | { |
| | | //var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(","); |
| | | //var sendColorString = color[0] + "," + color[1] + "," + color[2]; |
| | | //d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString); |
| | | //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); |
| | | d.Add(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); |
| | | function.SetAttrState(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); |
| | | } |
| | | //d.Add(FunctionAttributeKey.Colorful, "off"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | this.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | colorPicker.ColorChaged += (sender2, color) => { |
| | | byte redColor = color[0]; |
| | | byte greenColor = color[1]; |
| | | byte blueColor = color[2]; |
| | | redColor = color[0]; |
| | | greenColor = color[1]; |
| | | blueColor = color[2]; |
| | | |
| | | int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor; |
| | | |
| | |
| | | btnRecommenColor1.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor1.BackgroundColor; |
| | | etCurColorHexInfo.Text = "FC4645"; |
| | | redColor = 252; |
| | | greenColor = 70; |
| | | blueColor = 69; |
| | | |
| | | }; |
| | | btnRecommenColor2.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor2.BackgroundColor; |
| | | etCurColorHexInfo.Text = "FD834D"; |
| | | redColor = 253; |
| | | greenColor = 131; |
| | | blueColor = 77; |
| | | }; |
| | | btnRecommenColor3.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor3.BackgroundColor; |
| | | etCurColorHexInfo.Text = "00AB11"; |
| | | redColor = 0; |
| | | greenColor = 171; |
| | | blueColor = 17; |
| | | }; |
| | | btnRecommenColor4.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor4.BackgroundColor; |
| | | etCurColorHexInfo.Text = "28952E"; |
| | | redColor = 40; |
| | | greenColor = 149; |
| | | blueColor = 46; |
| | | }; |
| | | btnRecommenColor5.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor5.BackgroundColor; |
| | | etCurColorHexInfo.Text = "45B7FD"; |
| | | redColor = 69; |
| | | greenColor = 183; |
| | | blueColor = 253; |
| | | }; |
| | | btnRecommenColor6.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor6.BackgroundColor; |
| | | etCurColorHexInfo.Text = "794EFC"; |
| | | redColor = 121; |
| | | greenColor = 78; |
| | | blueColor = 252; |
| | | }; |
| | | btnRecommenColor7.MouseUpEventHandler = (sender, e) => { |
| | | curColor = btnCurColor.BackgroundColor = btnRecommenColor7.BackgroundColor; |
| | | etCurColorHexInfo.Text = "FFFFFF"; |
| | | redColor = 255; |
| | | greenColor = 255; |
| | | blueColor = 255; |
| | | }; |
| | | } |
| | | |