| | |
| | | using LB_VisionProcesses.Communicators; |
| | | using LB_VisionProcesses.Communicators.SiemensS7; |
| | | using LB_VisionProcesses.Communicators.TCom; |
| | | using ReaLTaiizor.Forms; |
| | | using RJCP.IO.Ports; |
| | |
| | | |
| | | namespace LB_SmartVision.Forms.Pages.CommunicatorPage |
| | | { |
| | | public partial class CommunicatorForm : MaterialForm |
| | | public partial class CommunicatorForm : Form |
| | | { |
| | | BaseCommunicator communicator { get; set; } |
| | | |
| | | public CommunicatorForm() |
| | | { |
| | | InitializeComponent(); |
| | | cmbType.Items.Clear(); |
| | | |
| | | if (communicator != null && !string.IsNullOrEmpty(communicator.CommunicatorConnections["型号"]?.ToString())) |
| | | { |
| | | cmbType.Items.Add(communicator.CommunicatorConnections["型号"]?.ToString()); |
| | | } |
| | | } |
| | | |
| | | public CommunicatorForm(BaseCommunicator communicator, string name) |
| | |
| | | cmbIP.Enabled = false; |
| | | txtIP.Enabled = false; |
| | | txtPort.Enabled = false; |
| | | |
| | | |
| | | lblType.Visible = false; |
| | | lblAddress.Visible = false; |
| | | cmbType.Visible = false; |
| | | txtAddress.Visible = false; |
| | | |
| | | |
| | | this.Text = name; |
| | | |
| | | if (communicator is UARTPort) |
| | |
| | | txtIP.Visible = false; |
| | | cmbIP.Visible = true; |
| | | |
| | | lblType.Visible = false; |
| | | lblAddress.Visible = false; |
| | | cmbType.Visible = false; |
| | | txtAddress.Visible = false; |
| | | |
| | | lblIP.Text = "COM口"; |
| | | lblPort.Text = "波特率"; |
| | | } |
| | | else if (communicator is TCPClient || communicator is TCPServer) |
| | | { |
| | | txtIP.Text = communicator.CommunicatorConnections["地址"]?.ToString(); |
| | | txtPort.Text = communicator.CommunicatorConnections["端口"]?.ToString(); |
| | | txtPort.SelectedText = communicator.CommunicatorConnections["端口"]?.ToString(); |
| | | txtIP.Visible = true; |
| | | cmbIP.Visible = false; |
| | | |
| | | lblType.Visible = false; |
| | | lblAddress.Visible = false; |
| | | cmbType.Visible = false; |
| | | txtAddress.Visible = false; |
| | | |
| | | lblIP.Text = "地址"; |
| | | lblPort.Text = "端口"; |
| | | } |
| | | else if (communicator is LocalMonitor) |
| | | else if (communicator is SiemensLBS7) |
| | | { |
| | | txtIP.Text = communicator.CommunicatorConnections["地址"]?.ToString(); |
| | | txtPort.Text = communicator.CommunicatorConnections["端口"]?.ToString(); |
| | | cmbType.Items.Clear(); |
| | | |
| | | if (!string.IsNullOrEmpty(communicator.CommunicatorConnections["型号"]?.ToString())) |
| | | { |
| | | cmbType.Items.Add(communicator.CommunicatorConnections["型号"]?.ToString()); |
| | | } |
| | | cmbType.Text = communicator.CommunicatorConnections["型号"]?.ToString(); |
| | | txtIP.Visible = true; |
| | | cmbIP.Visible = false; |
| | | |
| | | lblIP.Text = "监控文件"; |
| | | lblPort.Text = "写入文件"; |
| | | lblType.Visible = true; |
| | | lblAddress.Visible = true; |
| | | cmbType.Visible = true; |
| | | txtAddress.Visible = true; |
| | | |
| | | lblIP.Text = "IP"; |
| | | lblPort.Text = "槽"; |
| | | } |
| | | |
| | | this.communicator = communicator; |