ningshuxia
2025-03-31 d321346f204a69b1929cc39098a5d88f44509e7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using DevExpress.XtraEditors;
using IStation.Untity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.Monitor
{
    public partial class SetHzsDlg : DevExpress.XtraEditors.XtraForm
    {
        public SetHzsDlg()
        {
            InitializeComponent();
            IconOptions.Icon = WinFrmUI.Properties.Resources.App;
            dataLayoutControl1.SetupLayoutControl();
 
 
        }
 
        /// <summary>
        /// 回调事件
        /// </summary>
        public event Func<List<double>, bool> ReloadDataEvent;
 
 
        /// <summary>
        /// 绑定
        /// </summary>
        public void SetBindingData(List<double> hzs)
        {
            if (hzs == null)
                return;
            HzsTextEdit.EditValue = DoubleListHelper.ToString(hzs);
        }
 
        //验证
        private bool Valid()
        {
            dxErrorProvider1.ClearErrors();
 
 
            var hzs = HzsTextEdit.Text.Trim();
            if (string.IsNullOrEmpty(hzs))
            {
                dxErrorProvider1.SetError(HzsTextEdit, "必填项");
                return false;
            }
            else
            {
                var list = DoubleListHelper.ToList(hzs);
                if (list == null || !list.Any())
                {
                    dxErrorProvider1.SetError(HzsTextEdit, "必填项");
                    return false;
                }
            }
            return true;
        }
 
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Valid())
                return;
            var hzs = DoubleListHelper.ToList(HzsTextEdit.Text.Trim());
 
            if (ReloadDataEvent == null)
                return;
            if (!ReloadDataEvent(hzs))
            {
                XtraMessageBox.Show("更新失败!");
                return;
            }
            XtraMessageBox.Show("更新成功!");
            DialogResult = DialogResult.OK;
            Close();
        }
 
    }
}