| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | #region 炫彩开关 |
| | | contentView.AddChidren(new Button |
| | | { |
| | | Height = Application.GetRealHeight(10), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | |
| | | var viewSwitch = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(viewSwitch); |
| | | |
| | | var btnSwitchText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.ColorfulFunction, |
| | | }; |
| | | viewSwitch.AddChidren(btnSwitchText); |
| | | |
| | | var btnColorfulSwitch = new Button() |
| | | { |
| | | X = Application.GetRealWidth(314), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(48), |
| | | Height = Application.GetMinRealAverage(36), |
| | | UnSelectedImagePath = "Public/Switch.png", |
| | | SelectedImagePath = "Public/SwitchOn.png", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Colorful) == "on" |
| | | }; |
| | | viewSwitch.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); |
| | | if (controlColorfulState == "on") |
| | | { |
| | | var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(","); |
| | | var sendColorString = color[0] + "," + color[1] + "," + color[2]; |
| | | d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString); |
| | | color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(","); |
| | | sendColorString = color[0] + "," + color[1] + "," + color[2]; |
| | | d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString); |
| | | d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); |
| | | } |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"控制炫彩开关异常:{ex.Message}"); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | #region 起始颜色 |
| | | var startView = new FrameLayout() |
| | | { |