From 0b617e22e15bca0b3dbaebdc55015cc2792f6840 Mon Sep 17 00:00:00 2001
From: C3031 <shitiangui@lanpucloud.cn>
Date: 星期二, 06 一月 2026 16:15:01 +0800
Subject: [PATCH] 增加S7通讯界面
---
LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs | 47 ++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
index c582b42..08c07a7 100644
--- a/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
+++ b/LB_SmartVision/Forms/Pages/CommunicatorPage/CommunicatorForm.cs
@@ -1,4 +1,5 @@
锘縰sing LB_VisionProcesses.Communicators;
+using LB_VisionProcesses.Communicators.SiemensS7;
using LB_VisionProcesses.Communicators.TCom;
using ReaLTaiizor.Forms;
using RJCP.IO.Ports;
@@ -6,13 +7,19 @@
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)
@@ -24,6 +31,14 @@
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)
@@ -39,28 +54,50 @@
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;
--
Gitblit v1.9.3