代码地址:http://pan.baidu.com/share/link?shareid=3381776290&uk=588847378
新版本做了3个方面修改
1,修改了原有的打开关闭的链接图片,改到本地工程中
2,添加了定时发送机制
3,添加的帮助栏
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO.Ports;
using System.Threading;
using System.Diagnostics;
namespace ComAssistant1
{
public partial class ComAssis : Form
{
public enum LogMsgType { Incoming, Outgoing, Normal, Warning, Error };
public enum DataMode { Text, Hex }
private Color[] LogMsgTypeColor = { Color.Orange, Color.Green, Color.Black, Color.Blue, Color.Red };
/// 准备关闭串口=true
/// </summary>
private bool m_IsTryToClosePort = false;
/// <summary>
/// true表示正在接收数据
/// </summary>
private bool m_IsReceiving = false;
public ComAssis()
{
InitializeComponent();
}
Mutex m_Mutex = null;//锁
bool flag;
private void Form1_Load(object sender, EventArgs e)
{
//判断串口打开或关闭
if (serialPort1.IsOpen)
{
serialPort1.Close();
pictureBox1.Image = ComAssistant1.Properties.Resources.open;
}
else
{
pictureBox1.Image = ComAssistant1.Properties.Resources.close;
}
RefrespictureBox1();
int ii = 0;
foreach (string s in SerialPort.GetPortNames())
{
if (ii >= 1)
{
comboBox1.Items.Add(s);
}
ii++;
}
if (SerialPort.GetPortNames().Length != 0)
{
comboBox1.Text = (string)comboBox1.Items[0];
}
string[] ss = new string[] { "9600", "19200", "57600", "115200" };
comboBox2.DataSource = ss;
comboBox3.DataSource = Enum.GetNames(typeof(Parity));
ss = new string[] { "5", "6", "7", "8" };
comboBox4.DataSource = ss;
comboBox4.Text = "8";
comboBox5.DataSource &