浏览代码

添加指令窗口相关文件。

Dail 10 月之前
父节点
当前提交
62fcd1c07f

+ 156 - 0
Welling_Motor_Debug_Tool/DebugForm.Designer.cs

@@ -0,0 +1,156 @@
+namespace Welling_Motor_Debug_Tool
+{
+    partial class DebugForm
+    {
+        /// <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.button_DebugDisplay = new System.Windows.Forms.Button();
+            this.button_DebugClear = new System.Windows.Forms.Button();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.richTextBox_DebugRev = new System.Windows.Forms.RichTextBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.richTextBox_DebugSend = new System.Windows.Forms.RichTextBox();
+            this.button_DebugExport = new System.Windows.Forms.Button();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // button_DebugDisplay
+            // 
+            this.button_DebugDisplay.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.button_DebugDisplay.ForeColor = System.Drawing.Color.White;
+            this.button_DebugDisplay.Location = new System.Drawing.Point(12, 12);
+            this.button_DebugDisplay.Name = "button_DebugDisplay";
+            this.button_DebugDisplay.Size = new System.Drawing.Size(156, 40);
+            this.button_DebugDisplay.TabIndex = 0;
+            this.button_DebugDisplay.Text = "开始实时显示";
+            this.button_DebugDisplay.UseVisualStyleBackColor = false;
+            this.button_DebugDisplay.Click += new System.EventHandler(this.button_DebugDisplay_Click);
+            // 
+            // button_DebugClear
+            // 
+            this.button_DebugClear.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.button_DebugClear.ForeColor = System.Drawing.Color.White;
+            this.button_DebugClear.Location = new System.Drawing.Point(214, 12);
+            this.button_DebugClear.Name = "button_DebugClear";
+            this.button_DebugClear.Size = new System.Drawing.Size(156, 40);
+            this.button_DebugClear.TabIndex = 1;
+            this.button_DebugClear.Text = "清空";
+            this.button_DebugClear.UseVisualStyleBackColor = false;
+            this.button_DebugClear.Click += new System.EventHandler(this.button_DebugClear_Click);
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.richTextBox_DebugRev);
+            this.groupBox1.Location = new System.Drawing.Point(12, 58);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(560, 343);
+            this.groupBox1.TabIndex = 2;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "接收";
+            // 
+            // richTextBox_DebugRev
+            // 
+            this.richTextBox_DebugRev.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.richTextBox_DebugRev.Location = new System.Drawing.Point(6, 29);
+            this.richTextBox_DebugRev.Name = "richTextBox_DebugRev";
+            this.richTextBox_DebugRev.ReadOnly = true;
+            this.richTextBox_DebugRev.Size = new System.Drawing.Size(548, 308);
+            this.richTextBox_DebugRev.TabIndex = 0;
+            this.richTextBox_DebugRev.Text = "";
+            this.richTextBox_DebugRev.TextChanged += new System.EventHandler(this.richTextBox_DebugRev_TextChanged);
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.richTextBox_DebugSend);
+            this.groupBox2.Location = new System.Drawing.Point(12, 407);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(560, 350);
+            this.groupBox2.TabIndex = 3;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "发送";
+            // 
+            // richTextBox_DebugSend
+            // 
+            this.richTextBox_DebugSend.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.richTextBox_DebugSend.Location = new System.Drawing.Point(6, 29);
+            this.richTextBox_DebugSend.Name = "richTextBox_DebugSend";
+            this.richTextBox_DebugSend.ReadOnly = true;
+            this.richTextBox_DebugSend.Size = new System.Drawing.Size(548, 313);
+            this.richTextBox_DebugSend.TabIndex = 0;
+            this.richTextBox_DebugSend.Text = "";
+            this.richTextBox_DebugSend.TextChanged += new System.EventHandler(this.richTextBox_DebugSend_TextChanged);
+            // 
+            // button_DebugExport
+            // 
+            this.button_DebugExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.button_DebugExport.ForeColor = System.Drawing.Color.White;
+            this.button_DebugExport.Location = new System.Drawing.Point(416, 12);
+            this.button_DebugExport.Name = "button_DebugExport";
+            this.button_DebugExport.Size = new System.Drawing.Size(156, 40);
+            this.button_DebugExport.TabIndex = 4;
+            this.button_DebugExport.Text = "导出接收数据";
+            this.button_DebugExport.UseVisualStyleBackColor = false;
+            this.button_DebugExport.Click += new System.EventHandler(this.button_DebugExport_Click);
+            // 
+            // DebugForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.ClientSize = new System.Drawing.Size(584, 761);
+            this.Controls.Add(this.button_DebugExport);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.button_DebugClear);
+            this.Controls.Add(this.button_DebugDisplay);
+            this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+            this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
+            this.MaximizeBox = false;
+            this.Name = "DebugForm";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "指令显示";
+            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.DebugForm_FormClosed);
+            this.Load += new System.EventHandler(this.DebugForm_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox2.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button_DebugDisplay;
+        private System.Windows.Forms.Button button_DebugClear;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        public System.Windows.Forms.RichTextBox richTextBox_DebugRev;
+        public System.Windows.Forms.RichTextBox richTextBox_DebugSend;
+        private System.Windows.Forms.Button button_DebugExport;
+    }
+}

+ 81 - 0
Welling_Motor_Debug_Tool/DebugForm.cs

@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Welling_Motor_Debug_Tool
+{
+    public partial class DebugForm : Form
+    {
+        public static DebugForm debug1 = null;
+        public DebugForm()
+        {
+            InitializeComponent();
+        }
+
+        private void DebugForm_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void DebugForm_FormClosed(object sender, FormClosedEventArgs e)
+        {
+            mainForm.mainform1.指令调试ToolStripMenuItem.Checked = false;
+            mainForm.mainform1.DebugWindowIsOpen = false;
+            mainForm.mainform1.DebugDataDisplayEnable = false;
+        }
+
+        private void button_DebugClear_Click(object sender, EventArgs e)
+        {
+            richTextBox_DebugRev.Clear();
+            richTextBox_DebugSend.Clear();
+        }
+
+        private void button_DebugDisplay_Click(object sender, EventArgs e)
+        {
+            if (button_DebugDisplay.Text == "开始实时显示")
+            {
+                mainForm.mainform1.DebugDataDisplayEnable = true;
+                button_DebugDisplay.Text = "停止实时显示";
+            }
+            else
+            {
+                mainForm.mainform1.DebugDataDisplayEnable = false;
+                button_DebugDisplay.Text = "开始实时显示";
+            }
+        }
+
+        private void richTextBox_DebugRev_TextChanged(object sender, EventArgs e)
+        {
+            richTextBox_DebugRev.SelectionStart = richTextBox_DebugRev.Text.Length;
+            richTextBox_DebugRev.ScrollToCaret();
+        }
+
+        private void richTextBox_DebugSend_TextChanged(object sender, EventArgs e)
+        {
+            richTextBox_DebugSend.SelectionStart = richTextBox_DebugSend.Text.Length;
+            richTextBox_DebugSend.ScrollToCaret();
+        }
+
+        private void button_DebugExport_Click(object sender, EventArgs e)
+        {
+            SaveFileDialog sf = new SaveFileDialog();
+            sf.Title = "数据导出";
+            sf.FileName = "Rev_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("/", "-").Replace(":", string.Empty).Replace(" ", "_") + ".txt";
+            sf.Filter = "文本文件|*.txt";
+            if (sf.ShowDialog() == DialogResult.OK)
+            {
+               richTextBox_DebugRev.SaveFile(sf.FileName, RichTextBoxStreamType.PlainText);
+            }
+           
+        }
+
+       
+    }
+}

+ 120 - 0
Welling_Motor_Debug_Tool/DebugForm.resx

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