68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
using AntdUIDemo.Models;
|
|
using DHSoftware.Models;
|
|
using DHSoftware.Views;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AntdUIDemo.Views.Table
|
|
{
|
|
public partial class DefectRowEdit : UserControl
|
|
{
|
|
DetectConfigControl detectConfigControl;
|
|
private AntdUI.Window window;
|
|
private DefectRow user;
|
|
public bool submit;
|
|
public DefectRowEdit(AntdUI.Window _window, DefectRow _user)
|
|
{
|
|
this.window = _window;
|
|
user = _user;
|
|
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;
|
|
}
|
|
user.LabelDescription = input_name.Text;
|
|
user.ScoreMinValue =(double)input_minScore.Value;
|
|
user.ScoreMaxValue = (double)input_maxScore.Value;
|
|
user.AreaMinValue = (double)input_minArea.Value;
|
|
user.AreaMaxValue = (double)input_maxArea.Value;
|
|
submit = true;
|
|
this.Dispose();
|
|
}
|
|
|
|
private void InitData()
|
|
{
|
|
input_name.Text = user.LabelDescription;
|
|
// input_addr.Text = user.Address;
|
|
input_minScore.Value =(decimal) user.ScoreMinValue;
|
|
input_maxScore.Value =(decimal) user.ScoreMaxValue;
|
|
input_minArea.Value =(decimal) user.AreaMinValue;
|
|
input_maxArea.Value =(decimal) user.AreaMaxValue;
|
|
}
|
|
}
|
|
}
|