tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
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
using System.Collections.Generic;
using TProduct.Model;
 
namespace TProduct.WinFrmUI.TestBench
{
    public partial class PLC701ParasControl : DevExpress.XtraEditors.XtraUserControl
    {
        public PLC701ParasControl()
        {
            InitializeComponent();
 
 
 
            this.imgcomboxMsgTypePLC.SelectedIndex = 0;
        }
 
 
 
 
 
        public void InitialComPortList(IEnumerable<string> paras)
        {
            foreach (var item in paras)
            {
                this.txtComPortNamePLC.Properties.Items.Add(item, item, -1);
            }
            this.txtComPortNamePLC.SelectedIndex = 0;
        }
        Model.WorkBenchInstrumentKedi _instrument = null;
 
        public void SetBindingData(string link_tag, Model.WorkBenchInstrumentKedi instrument)
        {
            this._instrument = instrument;
            if (instrument != null)
            {
                this.txtComBaudRatePLC.EditValue = instrument.ComBaudRate;
                this.txtLinkInstrumentNOPLC.EditValue = instrument.InstrumentNO;
                this.txtComPortNamePLC.EditValue = instrument.ComPortName;
 
            }
        }
 
 
        public WorkBenchInstrumentKedi GetData()
        {
            if (this._instrument == null)
                this._instrument = new WorkBenchInstrumentKedi();
            this._instrument.InstrumentType = (int)TProduct.Model.WorkBenchInstrumentKedi.eKediInstrumentType.PLC;
 
            this._instrument.InstrumentNO = this.txtLinkInstrumentNOPLC.Text.Trim();
            this._instrument.UseStatus = eUseStatus.Enable;
            this._instrument.ComPortName = this.txtComPortNamePLC.Text.Trim();
            this._instrument.ComBaudRate = int.Parse(this.txtComBaudRatePLC.Text.Trim());  
            this._instrument.InstrumentType = (int)TProduct.Model.WorkBenchInstrumentKedi.eKediInstrumentType.PLC;
 
            return this._instrument;
        }
 
 
        public bool Verify()
        {
            this.dxErrorProvider1.ClearErrors();
 
            if (string.IsNullOrEmpty(this.txtComPortNamePLC.Text))
            {
                this.dxErrorProvider1.SetError(this.txtComPortNamePLC, "必填项!");
                return false;
            }
            if (string.IsNullOrEmpty(this.txtComBaudRatePLC.Text))
            {
                this.dxErrorProvider1.SetError(this.txtComBaudRatePLC, "必填项!");
                return false;
            }
 
            return true;
        }
    }
}