using System;
|
using Shared;
|
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
|
{
|
public class BrightnessView
|
{
|
/// <summary>
|
/// 主控件
|
/// </summary>
|
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),
|
};
|
/// <summary>
|
/// 标题Btn
|
/// </summary>
|
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)
|
};
|
/// <summary>
|
/// 取消Btn
|
/// </summary>
|
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)
|
};
|
/// <summary>
|
/// 确定Btn
|
/// </summary>
|
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),
|
};
|
/// <summary>
|
/// 图标-
|
/// </summary>
|
public Button btn_subtract = new Button
|
{
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
X = Application.GetRealWidth(26),
|
Y = Application.GetRealHeight(118),
|
UnSelectedImagePath = "LogicIcon/-.png",
|
};
|
/// <summary>
|
/// 图标-扩大热键
|
/// </summary>
|
public Button btn_subtract_click = new Button
|
{
|
Width = Application.GetMinRealAverage(24 + 20),
|
Height = Application.GetMinRealAverage(24),
|
X = Application.GetRealWidth(26 - 20),
|
Y = Application.GetRealHeight(118),
|
|
};
|
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,//显示百分比
|
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=5,//产品经理晓辉要求改的 2021-11-06
|
MaxValue=100,
|
Progress=5,//产品经理晓辉要求改的 2021-11-06
|
|
};
|
/// <summary>
|
/// 图标+
|
/// </summary>
|
public Button btn_add = new Button
|
{
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
X = Application.GetRealWidth(294),
|
Y = Application.GetRealHeight(118),
|
UnSelectedImagePath = "LogicIcon/+.png",
|
|
};
|
/// <summary>
|
/// 图标+扩大热键
|
/// </summary>
|
public Button btn_add_click = new Button
|
{
|
Width = Application.GetMinRealAverage(24 + 20),
|
Height = Application.GetMinRealAverage(24),
|
X = Application.GetRealWidth(294),
|
Y = Application.GetRealHeight(118),
|
};
|
|
|
|
/// <summary>
|
/// View的方法
|
/// </summary>
|
/// <param name="frame">父控件</param>
|
/// <param name="titleName">标题名称</param>
|
/// <param name="stateValue">之前状态值</param>
|
/// <param name="action">返回回调</param>
|
public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string> 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_subtract);
|
frameLayout.AddChidren(btn_subtract_click);
|
frameLayout.AddChidren(seekBarVol);
|
frameLayout.AddChidren(btn_add);
|
frameLayout.AddChidren(btn_add_click);
|
btnTitle.Text = titleName;
|
//第一个变化记录选中值
|
int brightnesValue = 0;
|
if (stateValue != "")
|
{
|
try
|
{
|
//进来的状态
|
brightnesValue = int.Parse(stateValue.Replace("%", ""));
|
seekBarVol.Progress = brightnesValue;
|
}
|
catch { }
|
}
|
//—点击事件
|
btn_subtract_click.MouseUpEventHandler += (sender2, e2) =>
|
{
|
if (brightnesValue > 0)
|
{
|
brightnesValue -= 1;
|
seekBarVol.Progress = brightnesValue;
|
}
|
};
|
//+点击事件
|
btn_add_click.MouseUpEventHandler += (sende2, e2) =>
|
{
|
if (brightnesValue < 100)
|
{
|
brightnesValue += 1;
|
seekBarVol.Progress = brightnesValue;
|
|
}
|
};
|
//进度条滑动点击事件
|
EventHandler<int> progressclick = (sender2, e2) =>
|
{
|
brightnesValue = seekBarVol.Progress;
|
};
|
seekBarVol.OnProgressChangedEvent += progressclick;
|
seekBarVol.OnStopTrackingTouchEvent += progressclick;
|
//取消点击事件
|
btnCancel.MouseUpEventHandler += (sender, e1) =>
|
{
|
//移除fLayout界面
|
fLayout.RemoveFromParent();
|
};
|
//确定点击事件
|
btnConfirm.MouseUpEventHandler += (sender, e1) =>
|
{
|
//if (brightnesValue == 0)
|
//{
|
// return;
|
//}
|
action(brightnesValue.ToString());
|
//移除fLayout界面
|
fLayout.RemoveFromParent();
|
};
|
|
|
}
|
|
|
|
|
///// <summary>
|
///// View的方法
|
///// </summary>
|
///// <param name="fLayout"></param>
|
//public void FLayoutView(FrameLayout fLayout)
|
//{
|
// fLayout.AddChidren(frameLayout);
|
// frameLayout.AddChidren(btnTitle);
|
// frameLayout.AddChidren(btnCancel);
|
// frameLayout.AddChidren(btnConfirm);
|
// frameLayout.AddChidren(btn_subtract);
|
// frameLayout.AddChidren(btn_subtract_click);
|
// frameLayout.AddChidren(seekBarVol);
|
// frameLayout.AddChidren(btn_add);
|
// frameLayout.AddChidren(btn_add_click);
|
// //取消点击事件
|
// btnCancel.MouseUpEventHandler += (sender, e1) =>
|
// {
|
// //移除fLayout界面
|
// fLayout.RemoveFromParent();
|
// };
|
|
//}
|
}
|
}
|