diff --git a/NDSD-Screwdriver/MainForm.Designer.cs b/NDSD-Screwdriver/MainForm.Designer.cs
new file mode 100644
index 0000000..407d929
--- /dev/null
+++ b/NDSD-Screwdriver/MainForm.Designer.cs
@@ -0,0 +1,123 @@
+namespace NDSD_Screwdriver
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.DOTest = new System.Windows.Forms.Button();
+ this.dataGridView1 = new System.Windows.Forms.DataGridView();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.dataGridView2 = new System.Windows.Forms.DataGridView();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
+ this.SuspendLayout();
+ //
+ // DOTest
+ //
+ this.DOTest.Location = new System.Drawing.Point(691, 12);
+ this.DOTest.Name = "DOTest";
+ this.DOTest.Size = new System.Drawing.Size(75, 23);
+ this.DOTest.TabIndex = 0;
+ this.DOTest.Text = "DO测试";
+ this.DOTest.UseVisualStyleBackColor = true;
+ this.DOTest.Click += new System.EventHandler(this.DOTest_Click);
+ //
+ // dataGridView1
+ //
+ this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView1.Location = new System.Drawing.Point(3, 21);
+ this.dataGridView1.Name = "dataGridView1";
+ this.dataGridView1.RowHeadersWidth = 51;
+ this.dataGridView1.RowTemplate.Height = 27;
+ this.dataGridView1.Size = new System.Drawing.Size(370, 826);
+ this.dataGridView1.TabIndex = 1;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.dataGridView1);
+ this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
+ this.groupBox1.Location = new System.Drawing.Point(772, 0);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(376, 850);
+ this.groupBox1.TabIndex = 2;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "日志";
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.dataGridView2);
+ this.groupBox2.Dock = System.Windows.Forms.DockStyle.Left;
+ this.groupBox2.Location = new System.Drawing.Point(0, 0);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(685, 850);
+ this.groupBox2.TabIndex = 3;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "工作状态";
+ //
+ // dataGridView2
+ //
+ this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView2.Location = new System.Drawing.Point(3, 21);
+ this.dataGridView2.Name = "dataGridView2";
+ this.dataGridView2.RowHeadersWidth = 51;
+ this.dataGridView2.RowTemplate.Height = 27;
+ this.dataGridView2.Size = new System.Drawing.Size(679, 826);
+ this.dataGridView2.TabIndex = 0;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1148, 850);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.DOTest);
+ this.Name = "MainForm";
+ this.Text = "MainForm";
+ this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button DOTest;
+ private System.Windows.Forms.DataGridView dataGridView1;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.DataGridView dataGridView2;
+ }
+}
\ No newline at end of file
diff --git a/NDSD-Screwdriver/MainForm.cs b/NDSD-Screwdriver/MainForm.cs
new file mode 100644
index 0000000..ab60879
--- /dev/null
+++ b/NDSD-Screwdriver/MainForm.cs
@@ -0,0 +1,53 @@
+using NDSD_TouchSocket;
+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 NDSD_Screwdriver
+{
+ public partial class MainForm : Form
+ {
+ DOperate DOperate;
+
+ TcpServer server = TcpServer.Instance;
+
+ public MainForm()
+ {
+ InitializeComponent();
+ DOperate = new DOperate();
+ if (!server.ServerOpen("192.168.0.101", "6001"))
+ {
+ MessageBox.Show("服务端打开失败!");
+ }
+ }
+
+ private void DOTest_Click(object sender, EventArgs e)
+ {
+ ScrewdriverTest screwdriverTest = new ScrewdriverTest(server, DOperate);
+ screwdriverTest.Show();
+ }
+
+ private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ if (server != null)
+ {
+ if (!server.ServerStop())
+ {
+ MessageBox.Show("服务端关闭失败!");
+ }
+ if (!server.ServerDispose())
+ {
+ MessageBox.Show("服务端释放失败!");
+ }
+
+
+ }
+ }
+ }
+}
diff --git a/NDSD-Screwdriver/MainForm.resx b/NDSD-Screwdriver/MainForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/NDSD-Screwdriver/MainForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/NDSD-Screwdriver/NDSD-Screwdriver.zip b/NDSD-Screwdriver/NDSD-Screwdriver.zip
new file mode 100644
index 0000000..473b625
Binary files /dev/null and b/NDSD-Screwdriver/NDSD-Screwdriver.zip differ
diff --git a/NDSD-Screwdriver/NDSD_Screwdriver.csproj b/NDSD-Screwdriver/NDSD_Screwdriver.csproj
index 8bc47f7..3a5e7ba 100644
--- a/NDSD-Screwdriver/NDSD_Screwdriver.csproj
+++ b/NDSD-Screwdriver/NDSD_Screwdriver.csproj
@@ -69,6 +69,12 @@
+
+ Form
+
+
+ MainForm.cs
+
@@ -77,6 +83,9 @@
ScrewdriverTest.cs
+
+ MainForm.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/NDSD-Screwdriver/Program.cs b/NDSD-Screwdriver/Program.cs
index b8786ae..6c0c939 100644
--- a/NDSD-Screwdriver/Program.cs
+++ b/NDSD-Screwdriver/Program.cs
@@ -22,7 +22,7 @@ namespace NDSD_Screwdriver
XTrace.UseConsole();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new ScrewdriverTest());
+ Application.Run(new MainForm());
}
}
}
diff --git a/NDSD-Screwdriver/ScrewdriverTest.cs b/NDSD-Screwdriver/ScrewdriverTest.cs
index dc4f4c5..cff8884 100644
--- a/NDSD-Screwdriver/ScrewdriverTest.cs
+++ b/NDSD-Screwdriver/ScrewdriverTest.cs
@@ -18,16 +18,17 @@ namespace NDSD_Screwdriver
{
DOperate DOperate;
- TcpServer server = TcpServer.Instance;
+ TcpServer server;
+
+ public ScrewdriverTest(TcpServer s, DOperate d) : this()
+ {
+ server = s;
+ DOperate = d;
+ }
public ScrewdriverTest()
{
InitializeComponent();
- DOperate = new DOperate();
- if(!server.ServerOpen("192.168.0.101", "6001"))
- {
- MessageBox.Show("服务端打开失败!");
- }
}
private void DOpenButton_Click(object sender, EventArgs e)
@@ -102,8 +103,7 @@ namespace NDSD_Screwdriver
private void ScrewdriverTest_FormClosed(object sender, FormClosedEventArgs e)
{
- server.ServerStop();
- server.ServerDispose();
+
}
private void DelayButton_Click(object sender, EventArgs e)
diff --git a/NDSD-TouchSocket/DOperate.cs b/NDSD-TouchSocket/DOperate.cs
index e0f714c..946efa4 100644
--- a/NDSD-TouchSocket/DOperate.cs
+++ b/NDSD-TouchSocket/DOperate.cs
@@ -34,7 +34,7 @@ namespace NDSD_TouchSocket
/// 延迟,1代表0.1s/100ms
public void DTimeOpen(int port, int delay)
{
- Server.SendMessage(sendAnalysis.DTimeOpenDataAnalysis((byte)(port + 4), delay));
+ DTimeOpen((Port)(port + 4), delay);
}
///
@@ -45,23 +45,23 @@ namespace NDSD_TouchSocket
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port));
}
-
+
///
- /// 枚举类控制接口关
+ /// int控制接口开
///
- /// Port枚举类D1-D16
- public void DClose(Port port)
+ /// int1-16
+ public void DOpen(int port)
{
- Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
+ DOpen((Port)(port + 4));
}
///
- /// int控制接口开
+ /// 枚举类控制接口关
///
- /// int1-16
- public void DOpen(int port)
+ /// Port枚举类D1-D16
+ public void DClose(Port port)
{
- Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)(port + 4)));
+ Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
}
///
@@ -70,7 +70,7 @@ namespace NDSD_TouchSocket
/// int1-16
public void DClose(int port)
{
- Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)(port + 4)));
+ DClose((Port)(port + 4));
}
}