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 = "停止实时显示"; button_DebugDisplay.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(215)))), ((int)(((byte)(0))))); } else { mainForm.mainform1.DebugDataDisplayEnable = false; button_DebugDisplay.Text = "开始实时显示"; button_DebugDisplay.BackColor = Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185))))); } } 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); } } } }