Commit b5267af2 authored by shaxuezheng's avatar shaxuezheng
parent 9141e4ff
namespace ModbusDemo
{
partial class ComPort
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label7 = new System.Windows.Forms.Label();
this.labPort = new System.Windows.Forms.Label();
this.cmbPort = new System.Windows.Forms.ComboBox();
this.cmbStopBit = new System.Windows.Forms.ComboBox();
this.btCloseCOM = new System.Windows.Forms.Button();
this.cmbParity = new System.Windows.Forms.ComboBox();
this.btOpenCOM = new System.Windows.Forms.Button();
this.cmbDataBit = new System.Windows.Forms.ComboBox();
this.labStopBit = new System.Windows.Forms.Label();
this.labParity = new System.Windows.Forms.Label();
this.labBaud = new System.Windows.Forms.Label();
this.labDataBit = new System.Windows.Forms.Label();
this.cmbBaud = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// label7
//
this.label7.Font = new System.Drawing.Font("Arial", 8F);
this.label7.ForeColor = System.Drawing.Color.Blue;
this.label7.Location = new System.Drawing.Point(3, 17);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(140, 17);
this.label7.TabIndex = 47;
this.label7.Text = "Connection Status";
//
// labPort
//
this.labPort.Font = new System.Drawing.Font("Arial", 8F);
this.labPort.Location = new System.Drawing.Point(3, 34);
this.labPort.Name = "labPort";
this.labPort.Size = new System.Drawing.Size(75, 15);
this.labPort.TabIndex = 53;
this.labPort.Text = "COM Port";
this.labPort.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// cmbPort
//
this.cmbPort.Font = new System.Drawing.Font("Arial", 8F);
this.cmbPort.Location = new System.Drawing.Point(3, 49);
this.cmbPort.Name = "cmbPort";
this.cmbPort.Size = new System.Drawing.Size(75, 22);
this.cmbPort.TabIndex = 52;
//
// cmbStopBit
//
this.cmbStopBit.Font = new System.Drawing.Font("Arial", 8F);
this.cmbStopBit.Items.AddRange(new object[] {
"1",
"2"});
this.cmbStopBit.Location = new System.Drawing.Point(337, 49);
this.cmbStopBit.Name = "cmbStopBit";
this.cmbStopBit.Size = new System.Drawing.Size(56, 22);
this.cmbStopBit.TabIndex = 57;
//
// btCloseCOM
//
this.btCloseCOM.Enabled = false;
this.btCloseCOM.Font = new System.Drawing.Font("Arial", 8F);
this.btCloseCOM.Location = new System.Drawing.Point(315, 75);
this.btCloseCOM.Name = "btCloseCOM";
this.btCloseCOM.Size = new System.Drawing.Size(78, 23);
this.btCloseCOM.TabIndex = 59;
this.btCloseCOM.Text = "Close";
this.btCloseCOM.Click += new System.EventHandler(this.btCloseCOM_Click);
//
// cmbParity
//
this.cmbParity.Font = new System.Drawing.Font("Arial", 8F);
this.cmbParity.Items.AddRange(new object[] {
"0-None Parity",
"1-Odd Parity",
"2-Even Parity"});
this.cmbParity.Location = new System.Drawing.Point(224, 49);
this.cmbParity.Name = "cmbParity";
this.cmbParity.Size = new System.Drawing.Size(100, 22);
this.cmbParity.TabIndex = 56;
//
// btOpenCOM
//
this.btOpenCOM.Font = new System.Drawing.Font("Arial", 8F);
this.btOpenCOM.Location = new System.Drawing.Point(224, 75);
this.btOpenCOM.Name = "btOpenCOM";
this.btOpenCOM.Size = new System.Drawing.Size(78, 23);
this.btOpenCOM.TabIndex = 58;
this.btOpenCOM.Text = "Open";
this.btOpenCOM.Click += new System.EventHandler(this.btOpenCOM_Click);
//
// cmbDataBit
//
this.cmbDataBit.Font = new System.Drawing.Font("Arial", 8F);
this.cmbDataBit.Items.AddRange(new object[] {
"7",
"8"});
this.cmbDataBit.Location = new System.Drawing.Point(168, 49);
this.cmbDataBit.Name = "cmbDataBit";
this.cmbDataBit.Size = new System.Drawing.Size(48, 22);
this.cmbDataBit.TabIndex = 55;
//
// labStopBit
//
this.labStopBit.Font = new System.Drawing.Font("Arial", 8F);
this.labStopBit.Location = new System.Drawing.Point(337, 34);
this.labStopBit.Name = "labStopBit";
this.labStopBit.Size = new System.Drawing.Size(56, 15);
this.labStopBit.TabIndex = 60;
this.labStopBit.Text = "Stop Bit";
this.labStopBit.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// labParity
//
this.labParity.Font = new System.Drawing.Font("Arial", 8F);
this.labParity.Location = new System.Drawing.Point(226, 34);
this.labParity.Name = "labParity";
this.labParity.Size = new System.Drawing.Size(98, 15);
this.labParity.TabIndex = 61;
this.labParity.Text = "Parity";
this.labParity.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// labBaud
//
this.labBaud.Font = new System.Drawing.Font("Arial", 8F);
this.labBaud.Location = new System.Drawing.Point(84, 34);
this.labBaud.Name = "labBaud";
this.labBaud.Size = new System.Drawing.Size(75, 15);
this.labBaud.TabIndex = 62;
this.labBaud.Text = "Baudrate";
this.labBaud.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// labDataBit
//
this.labDataBit.Font = new System.Drawing.Font("Arial", 8F);
this.labDataBit.Location = new System.Drawing.Point(168, 34);
this.labDataBit.Name = "labDataBit";
this.labDataBit.Size = new System.Drawing.Size(48, 15);
this.labDataBit.TabIndex = 63;
this.labDataBit.Text = "Data Bit";
this.labDataBit.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// cmbBaud
//
this.cmbBaud.Font = new System.Drawing.Font("Arial", 8F);
this.cmbBaud.Items.AddRange(new object[] {
"1200",
"2400",
"4800",
"9600",
"19200",
"38400",
"57600",
"115200"});
this.cmbBaud.Location = new System.Drawing.Point(83, 49);
this.cmbBaud.Name = "cmbBaud";
this.cmbBaud.Size = new System.Drawing.Size(76, 22);
this.cmbBaud.TabIndex = 54;
//
// ComPort
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cmbStopBit);
this.Controls.Add(this.btCloseCOM);
this.Controls.Add(this.cmbParity);
this.Controls.Add(this.btOpenCOM);
this.Controls.Add(this.cmbDataBit);
this.Controls.Add(this.labStopBit);
this.Controls.Add(this.labParity);
this.Controls.Add(this.labBaud);
this.Controls.Add(this.labDataBit);
this.Controls.Add(this.cmbBaud);
this.Controls.Add(this.labPort);
this.Controls.Add(this.cmbPort);
this.Controls.Add(this.label7);
this.Name = "ComPort";
this.Size = new System.Drawing.Size(400, 106);
this.Load += new System.EventHandler(this.ComPort_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label labPort;
private System.Windows.Forms.ComboBox cmbPort;
private System.Windows.Forms.ComboBox cmbStopBit;
private System.Windows.Forms.Button btCloseCOM;
private System.Windows.Forms.ComboBox cmbParity;
private System.Windows.Forms.Button btOpenCOM;
private System.Windows.Forms.ComboBox cmbDataBit;
private System.Windows.Forms.Label labStopBit;
private System.Windows.Forms.Label labParity;
private System.Windows.Forms.Label labBaud;
private System.Windows.Forms.Label labDataBit;
private System.Windows.Forms.ComboBox cmbBaud;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
namespace ModbusDemo
{
public partial class ComPort : UserControl
{
public ComPort()
{
InitializeComponent();
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;//设置该属性 为false
}
private byte slaveID = 1;
private SerialPort comPort = new SerialPort();
private void ComPort_Load(object sender, EventArgs e)
{
cmbBaud.SelectedIndex = 7;
cmbDataBit.SelectedIndex = 1;
cmbParity.SelectedIndex = 0;
cmbStopBit.SelectedIndex = 0;
foreach (string s in SerialPort.GetPortNames())
cmbPort.Items.Add(s);
cmbPort.SelectedIndex = -1;
}
private void btOpenCOM_Click(object sender, EventArgs e)
{
if (cmbPort.Text == "")
{
MessageBox.Show("串口打开错误");
return;
}
comPort.PortName = cmbPort.Text;
comPort.BaudRate = int.Parse(cmbBaud.Text);
comPort.DataBits = int.Parse(cmbDataBit.Text);
if (cmbParity.Text.Substring(0, 1) == "0")
{
comPort.Parity = Parity.None;
}
else if (cmbParity.Text.Substring(0, 1) == "1")
{
comPort.Parity = Parity.Odd;
}
else if (cmbParity.Text.Substring(0, 1) == "2")
{
comPort.Parity = Parity.Even;
}
if (cmbStopBit.Text == "0")
{
comPort.StopBits = StopBits.None;
}
else if (cmbStopBit.Text == "1")
{
comPort.StopBits = StopBits.One;
}
try
{
comPort.Open();
//comPort.Write("01 03 00 00 00 05 85 C9");//写数据
comPort.DataReceived += new SerialDataReceivedEventHandler(post_DataReceived);//串口接收处理函数
btOpenCOM.Enabled = false;
btCloseCOM.Enabled = true;
Console.WriteLine(DateTime.Now.ToString() + " =>Open " + comPort.PortName + " sucessfully!");
//MessageBox.Show(DateTime.Now.ToString() + System.Environment.NewLine + " =>Open " + comPort.PortName + " sucessfully!");
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
MessageBox.Show("Error: " + ex.Message);
return;
}
}
//字节数组转16进制字符串
public static string byteToHexStr(byte[] bytes)
{
string returnStr = "";
if (bytes != null)
{
for (int i = 0; i < bytes.Length; i++)
{
returnStr += bytes[i].ToString("X2");
}
}
return returnStr;
}
static int buffersize = 18; //十六进制数的大小(假设为9Byte,可调整数字大小)
byte[] buffer = new Byte[buffersize]; //创建缓冲区
private void post_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
int size = 0;
comPort.Read(buffer, 0, buffersize);
string ss;
ss = byteToHexStr(buffer); //用到函数byteToHexStr
Console.WriteLine(comPort.ReadExisting());
Console.WriteLine(ss);
size = comPort.ReadBufferSize;
if (buffer[0]==255)
{
modbus_Master.TepArray[0] = buffer[0];
modbus_Master.Sign = 2;
Console.WriteLine(comPort.ReadExisting());
}
else
{
modbus_Master.Sign =1;
modbus_Master.TepArray[0] = 0;
}
}
private void btCloseCOM_Click(object sender, EventArgs e)
{
//Close comport first,then stop and dispose slave.
comPort.Close();
btOpenCOM.Enabled = true;
btCloseCOM.Enabled = false;
Console.WriteLine(DateTime.Now.ToString() + " =>Disconnect " + comPort.PortName);
MessageBox.Show(DateTime.Now.ToString() + System.Environment.NewLine + " =>Disconnect " + comPort.PortName);
}
}
}
<?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.objec
oap.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>
\ No newline at end of file
/// <summary>
/// 类说明:Assistant
/// 编 码 人:苏飞
/// 联系方式:361983679
/// 更新网站:http://www.cckan.net/thread-655-1-1.html
/// </summary>
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
......
This diff is collapsed.
This diff is collapsed.
<?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>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -85,12 +85,6 @@
<Compile Include="478C.cs" />
<Compile Include="418X.cs" />
<Compile Include="Common\Modbuslib.cs" />
<Compile Include="ComPort.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ComPort.Designer.cs">
<DependentUpon>ComPort.cs</DependentUpon>
</Compile>
<Compile Include="ConvertJson.cs" />
<Compile Include="windows\Form1.cs">
<SubType>Form</SubType>
......@@ -98,92 +92,26 @@
<Compile Include="windows\Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="modbus-Master.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="modbus-Master.Designer.cs">
<DependentUpon>modbus-Master.cs</DependentUpon>
</Compile>
<Compile Include="mqttpacke.cs" />
<Compile Include="RData.cs" />
<Compile Include="UData.cs" />
<Compile Include="windows\AC.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\AC.Designer.cs">
<DependentUpon>AC.cs</DependentUpon>
</Compile>
<Compile Include="Common\ModSearch.cs" />
<Compile Include="Common\WTModbus.cs" />
<Compile Include="windows\Demo_818X.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\Demo_818X.Designer.cs">
<DependentUpon>Demo_818X.cs</DependentUpon>
</Compile>
<Compile Include="windows\frmInputValue.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\frmInputValue.designer.cs">
<DependentUpon>frmInputValue.cs</DependentUpon>
</Compile>
<Compile Include="windows\MDemo.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\MDemo.Designer.cs">
<DependentUpon>MDemo.cs</DependentUpon>
</Compile>
<Compile Include="Modbus-slave.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Modbus-slave.Designer.cs">
<DependentUpon>Modbus-slave.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="windows\ProTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\ProTest.Designer.cs">
<DependentUpon>ProTest.cs</DependentUpon>
</Compile>
<Compile Include="UserMQTT.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UserMQTT.Designer.cs">
<DependentUpon>UserMQTT.cs</DependentUpon>
</Compile>
<Compile Include="windows\sanchen.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="windows\sanchen.Designer.cs">
<DependentUpon>sanchen.cs</DependentUpon>
</Compile>
<Compile Include="Totxt.cs" />
<EmbeddedResource Include="ComPort.resx">
<DependentUpon>ComPort.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="modbus-Master.resx">
<DependentUpon>modbus-Master.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\AC.resx">
<DependentUpon>AC.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\Demo_818X.resx">
<DependentUpon>Demo_818X.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\frmInputValue.resx">
<DependentUpon>frmInputValue.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\MDemo.resx">
<DependentUpon>MDemo.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Modbus-slave.resx">
<DependentUpon>Modbus-slave.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -194,15 +122,6 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="windows\ProTest.resx">
<DependentUpon>ProTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserMQTT.resx">
<DependentUpon>UserMQTT.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="windows\sanchen.resx">
<DependentUpon>sanchen.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
......
This diff is collapsed.
This diff is collapsed.
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="bgWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 16</value>
</metadata>
</root>
\ No newline at end of file
namespace ModbusDemo
{
partial class AC
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AC));
this.userMQTT1 = new ModbusDemo.UserMQTT();
this.modbus_slave1 = new ModbusDemo.Modbus_slave();
this.SuspendLayout();
//
// userMQTT1
//
this.userMQTT1.Location = new System.Drawing.Point(12, 12);
this.userMQTT1.Name = "userMQTT1";
this.userMQTT1.Size = new System.Drawing.Size(659, 467);
this.userMQTT1.TabIndex = 0;
//
// modbus_slave1
//
this.modbus_slave1.Location = new System.Drawing.Point(677, 12);
this.modbus_slave1.Name = "modbus_slave1";
this.modbus_slave1.Size = new System.Drawing.Size(503, 308);
this.modbus_slave1.TabIndex = 1;
//
// AC
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1183, 488);
this.Controls.Add(this.modbus_slave1);
this.Controls.Add(this.userMQTT1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AC";
this.Text = "AC";
this.Load += new System.EventHandler(this.AC_Load);
this.ResumeLayout(false);
}
#endregion
private UserMQTT userMQTT1;
private Modbus_slave modbus_slave1;
}
}
\ No newline at end of file
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 ModbusDemo
{
public partial class AC : Form
{
public AC()
{
InitializeComponent();
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
}
private void AC_Load(object sender, EventArgs e)
{
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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 ModbusDemo.windows
{
public partial class sanchen : Form
{
public sanchen()
{
InitializeComponent();
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;//设置该属性 为false
}
private void sanchen_Load(object sender, EventArgs e)
{
this.Text = "WTD93UG" + "  (V." + Application.ProductVersion + ")";
}
private void sanchen_FormClosing(object sender, FormClosingEventArgs e)
{
System.Environment.Exit(0);
}
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment