add - 新建窗口功能移动

master
SoulStar 1 month ago
parent 10df8b5eda
commit b83ce2e749

@ -0,0 +1,123 @@
namespace NDSD_Screwdriver
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

@ -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("服务端释放失败!");
}
}
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -69,6 +69,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AppTool.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScrewdriverTest.cs">
@ -77,6 +83,9 @@
<Compile Include="ScrewdriverTest.Designer.cs">
<DependentUpon>ScrewdriverTest.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

@ -22,7 +22,7 @@ namespace NDSD_Screwdriver
XTrace.UseConsole();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ScrewdriverTest());
Application.Run(new MainForm());
}
}
}

@ -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)

@ -34,7 +34,7 @@ namespace NDSD_TouchSocket
/// <param name="delay">延迟1代表0.1s/100ms</param>
public void DTimeOpen(int port, int delay)
{
Server.SendMessage(sendAnalysis.DTimeOpenDataAnalysis((byte)(port + 4), delay));
DTimeOpen((Port)(port + 4), delay);
}
/// <summary>
@ -45,23 +45,23 @@ namespace NDSD_TouchSocket
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port));
}
/// <summary>
/// 枚举类控制接口关
/// int控制接口开
/// </summary>
/// <param name="port">Port枚举类D1-D16</param>
public void DClose(Port port)
/// <param name="port">int1-16</param>
public void DOpen(int port)
{
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
DOpen((Port)(port + 4));
}
/// <summary>
/// int控制接口开
/// 枚举类控制接口关
/// </summary>
/// <param name="port">int1-16</param>
public void DOpen(int port)
/// <param name="port">Port枚举类D1-D16</param>
public void DClose(Port port)
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)(port + 4)));
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
}
/// <summary>
@ -70,7 +70,7 @@ namespace NDSD_TouchSocket
/// <param name="port">int1-16</param>
public void DClose(int port)
{
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)(port + 4)));
DClose((Port)(port + 4));
}
}

Loading…
Cancel
Save