using System; using Shared; namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView { public class ColorTemperature { /// /// 主控件 /// public FrameLayout frameLayout = new FrameLayout { Y = Application.GetRealHeight(467), Height = Application.GetRealHeight(56 + 124), Width = Application.GetRealWidth(343), X = Application.GetRealWidth(16), BackgroundColor = CSS.CSS_Color.view, Radius = (uint)Application.GetRealHeight(12), }; /// /// 标题Btn /// public Button btnTitle = new Button { TextID = StringId.timeHorizon, TextSize = TextSize.text16, TextColor = CSS.CSS_Color.textColor, IsBold = true, Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), Height = Application.GetRealHeight(22), Y = Application.GetRealHeight(17), X = Application.GetRealWidth(52 + 4 + 10) }; /// /// 取消Btn /// public Button btnCancel = new Button { TextID = StringId.cancelSelected, TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textCancelColor, Width = Application.GetRealWidth(52), Height = Application.GetRealHeight(32), Y = Application.GetRealHeight(10), X = Application.GetRealWidth(4) }; /// /// 确定Btn /// public Button btnConfirm = new Button { TextID = StringId.confirmSelected, TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textConfirmColor, Width = Application.GetRealWidth(52), Height = Application.GetRealHeight(32), X = Application.GetRealWidth(343 - 4 - 52), Y = Application.GetRealHeight(10), }; /// /// 左边文本 /// public Button btn_left = new Button { Width = Application.GetRealWidth(35), Height = Application.GetRealWidth(24), X = Application.GetRealWidth(15), Y = Application.GetRealHeight(118), Text= "2700k", TextColor= CSS.CSS_Color.textCancelColor, TextSize = TextSize.text12, TextAlignment=TextAlignment.CenterLeft, }; public DiyImageSeekBar seekBarVol = new DiyImageSeekBar { Y = Application.GetRealHeight(103),//进度条父控件Y坐标 X = Application.GetRealWidth(62 - 10),//进度条X坐标 SeekBarPadding = Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距); Width = Application.GetRealWidth(240),//进度条的长度 Height = Application.GetRealHeight(54),//进度条父控件高度 IsProgressTextShow = true,//显示百分比 ProgressBarUnitSring="k", IsClickable = true,//进度条是否滑动 ProgressBarColor = CSS.CSS_Color.textConfirmColor,//选中进度条颜色 ThumbImagePath = "LogicIcon/point.png",//进度条按钮图标 ThumbImageHeight = Application.GetRealHeight(54),//进度条按钮图标的高度(默认正方形:宽和高一样) ProgressTextColor = CSS.CSS_Color.textColor, ProgressTextSize = 10,//显示百分比字体大小 SeekBarViewHeight = Application.GetRealHeight(8),//进度条的高度 MinValue = 2700, MaxValue = 6500, }; /// /// 右边文本 /// public Button btn_right = new Button { Width = Application.GetRealWidth(35), Height = Application.GetRealWidth(24), X = Application.GetRealWidth(294), Y = Application.GetRealHeight(118), Text = "6500k", TextColor = CSS.CSS_Color.textCancelColor, TextSize = TextSize.text12, TextAlignment = TextAlignment.CenterRight, }; /// /// View的方法 /// /// 父控件 /// 标题名称 /// 之前状态值 /// 返回回调 public void FLayoutView(FrameLayout frame, string titleName, string stateValue, Action action) { FrameLayout fLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; frame.AddChidren(fLayout); fLayout.AddChidren(frameLayout); frameLayout.AddChidren(btnTitle); frameLayout.AddChidren(btnCancel); frameLayout.AddChidren(btnConfirm); frameLayout.AddChidren(btn_left); frameLayout.AddChidren(seekBarVol); frameLayout.AddChidren(btn_right); btnTitle.Text = titleName; //第一个变化记录选中值 int brightnesValue = 0; if (stateValue != "") { try { brightnesValue = int.Parse(UnitDisposeSring(stateValue)); seekBarVol.Progress = brightnesValue; } catch { } } //进度条滑动点击事件 EventHandler progressclick = (sender2, e2) => { brightnesValue = seekBarVol.Progress; }; seekBarVol.OnProgressChangedEvent += progressclick; seekBarVol.OnStopTrackingTouchEvent += progressclick; //取消点击事件 btnCancel.MouseUpEventHandler += (sender, e1) => { //移除fLayout界面 fLayout.RemoveFromParent(); }; //确定点击事件 btnConfirm.MouseUpEventHandler += (sender, e1) => { action(brightnesValue.ToString(), UnitSring(stateValue)); //移除fLayout界面 fLayout.RemoveFromParent(); }; } /// //进度值显示单位 /// /// /// public string UnitSring(string str) { //进来的状态 if (str.Contains("k")) { //百分比 return "k"; } else { //没有单位 return ""; } } /// ///去单位 /// /// /// public string UnitDisposeSring(string str) { //进来的状态 if (str.Contains("k")) { // return str.Replace("k", ""); } else { //没有单位 return str; } } } }