| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// 色盘里面那个会滑动的球 |
| | | /// </summary> |
| | | Button btnWhiteRound; |
| | | /// <summary> |
| | | /// 炫彩开关按钮 |
| | | /// </summary> |
| | | Button btnColorfulSwitch; |
| | | |
| | | #endregion |
| | | |
| | | #region 区域变量 |
| | |
| | | FrameLayout 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", |
| | |
| | | dimmerBar = new DiyImageSeekBar() |
| | | { |
| | | X = Application.GetRealWidth(35 + 22), |
| | | Y = Application.GetRealHeight(312 - magriHeight), |
| | | Y = Application.GetRealHeight(316 - magriHeight), |
| | | Width = Application.GetRealWidth(210), |
| | | Height = Application.GetRealHeight(54), |
| | | SeekBarViewHeight = Application.GetRealHeight(8), |
| | |
| | | |
| | | barFadeTime = new DiyImageSeekBar() |
| | | { |
| | | X = btnGradualChangeMinValuesText.Right, |
| | | X = Application.GetRealWidth(35 + 22), |
| | | Y = Application.GetRealHeight(412 - 21-magriHeight), |
| | | Width = Application.GetRealWidth(210), |
| | | Height = Application.GetRealHeight(54), |
| | |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | }; |
| | | controlView.AddChidren(barFadeTime); |
| | | barFadeTime.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | function.UpdataFuncitonInfo(); |
| | | }; |
| | | //barFadeTime.OnStopTrackingTouchEvent = (sender, e) => |
| | | //{ |
| | | // function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | // function.UpdataFuncitonInfo(); |
| | | //}; |
| | | |
| | | var btnGradualChangeMaxValuesText = new Button() |
| | | { |
| | |
| | | }; |
| | | controlView.AddChidren(btnGradualChangeMaxValuesText); |
| | | #endregion |
| | | heightMore = 70; |
| | | //heightMore += 70; |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | #region 炫彩功能 |
| | | |
| | | |
| | | var btnGradualChangeText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(375+ heightMore- magriHeight), |
| | | Y = Application.GetRealHeight(heightMore + magriHeight), |
| | | Width = Application.GetRealWidth(224), |
| | | Height = Application.GetRealHeight(21), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | }; |
| | | controlView.AddChidren(btnGradualChangeText); |
| | | |
| | | var btnGradualChangeMinValuesText = new Button() |
| | | var btnEditColorful = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), |
| | |
| | | Height = Application.GetRealHeight(21), |
| | | UnSelectedImagePath = "Public/Edit.png", |
| | | }; |
| | | controlView.AddChidren(btnGradualChangeMinValuesText); |
| | | btnGradualChangeMinValuesText.MouseUpEventHandler = (sender, e) => { |
| | | controlView.AddChidren(btnEditColorful); |
| | | btnEditColorful.MouseUpEventHandler = (sender, e) => { |
| | | var rgbView = new ColorfulInfoPage(function); |
| | | MainPage.BasePageView.AddChidren(rgbView); |
| | | rgbView.LoadPage(); |
| | |
| | | |
| | | var barColorful = new FrameLayout() |
| | | { |
| | | X = btnGradualChangeMinValuesText.Right + Application.GetRealWidth(15), |
| | | Y = Application.GetRealHeight(412 + heightMore-magriHeight), |
| | | X = btnEditColorful.Right + Application.GetRealWidth(15), |
| | | Y = Application.GetRealHeight(37 + heightMore + magriHeight), |
| | | Width = Application.GetRealWidth(180), |
| | | Height = Application.GetRealHeight(10), |
| | | BackgroundImagePath = "FunctionIcon/Light/ColorWheel.png", |
| | | Height = Application.GetRealHeight(8), |
| | | BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png", |
| | | }; |
| | | controlView.AddChidren(barColorful); |
| | | |
| | | var btnGradualChangeMaxValuesText = new Button() |
| | | btnColorfulSwitch = new Button() |
| | | { |
| | | X = barFadeTime.Right, |
| | | X = barColorful.Right + Application.GetRealWidth(8), |
| | | Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(35), |
| | | Height = Application.GetRealHeight(21), |
| | | UnSelectedImagePath = "Public/Switch.png" |
| | | Width = Application.GetRealWidth(38), |
| | | Height = Application.GetRealHeight(24), |
| | | 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); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.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 |
| | | |
| | | |
| | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | Control.Ins.SendReadCommand(function); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | new System.Threading.Thread(() => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | |
| | | } |
| | | else |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | System.Threading.Thread.Sleep(1000); |
| | | Control.Ins.SendReadCommand(function); |
| | | curDimmerStatus = true; |
| | | } |
| | | } |