59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
|
|
|
|
using DH.Commons.Base;
|
|
using DH.Devices.Vision;
|
|
|
|
namespace DHSoftware.Views
|
|
{
|
|
public partial class PreTreatEdit : UserControl
|
|
{
|
|
private AntdUI.Window window;
|
|
private PreTreatParam PreTreat;
|
|
public bool submit;
|
|
public PreTreatEdit(AntdUI.Window _window, PreTreatParam preTreat)
|
|
{
|
|
this.window = _window;
|
|
PreTreat = preTreat;
|
|
InitializeComponent();
|
|
//设置默认值
|
|
InitData();
|
|
// 绑定事件
|
|
BindEventHandler();
|
|
}
|
|
|
|
private void BindEventHandler()
|
|
{
|
|
button_ok.Click += Button_ok_Click;
|
|
button_cancel.Click += Button_cancel_Click;
|
|
}
|
|
|
|
private void Button_cancel_Click(object sender, EventArgs e)
|
|
{
|
|
submit = false;
|
|
this.Dispose();
|
|
}
|
|
|
|
private void Button_ok_Click(object sender, EventArgs e)
|
|
{
|
|
input_name.Status = AntdUI.TType.None;
|
|
//检查输入内容
|
|
if (String.IsNullOrEmpty(input_name.Text))
|
|
{
|
|
input_name.Status = AntdUI.TType.Error;
|
|
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
|
return;
|
|
}
|
|
PreTreat.Name = input_name.Text;
|
|
PreTreat.Value = input_value.Value.ToString();
|
|
submit = true;
|
|
this.Dispose();
|
|
}
|
|
|
|
private void InitData()
|
|
{
|
|
input_name.Text = PreTreat.Name;
|
|
input_value.Value = Convert.ToDecimal(PreTreat.Value);
|
|
}
|
|
}
|
|
}
|