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;
|
}
|
}
|
}
|