tangxu
2024-06-11 e08f18c84c96ca794407f4fcb737b26fa76c0a1f
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
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.Monitor
{
    public partial class SetRangeDlg : DevExpress.XtraEditors.XtraForm
    {
        public SetRangeDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = IStation.WinFrmUI.Properties.Resources.App;
        }
 
        public double MinValue { get; private set; }
        public double MaxValue { get; private set; }
 
        private bool Valid()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.txtMinValue.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtMinValue, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMaxValue.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtMaxValue, "必填项");
                return false;
            }
            return true;
        }
 
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Valid())
                return;
            this.MinValue = double.Parse(this.txtMinValue.Text);
            this.MaxValue = double.Parse(this.txtMaxValue.Text);
            if (this.MinValue > this.MaxValue)
            {
                XtraMessageBox.Show("区间设置不合理!");
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}