using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Com_zhx
{
public partial class Form1 : Form
{
#region**参数设置**
private static SerialPort sp = null;
private static Boolean isSetProperty = false;
private static String[] rates = { "2400", "4800", "9600", "19200", "38400", "43000", "56000", "57600", "115200"};
private static String[] paritys = { "None", "奇校验", "偶校验" };
private static String[] dataBits = { "5", "6", "7", "8" };
private static String[] stopBits = { "0","1", "1.5","2" };
#endregion
#region**初始化**
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//加载所有
//Com_zhx.Profile.SaveProfile();
Com_zhx.Profile.LoadProfile();
DTR.Enabled = false;
RTS.Enabled = false;
//加载可用串口,波特率,校验位,数据位,停止位
SearchPort();
Load_Rate();
Load_Parity();
Load_DataBits();
Load_StopBits();
Auto_SenT_Initialize();
}
#endregion
#region**搜索串口按钮**
private void Search_ComPort_Click(object sender, EventArgs e)
{
SearchPort();
}
#endregion
#region**开关串口**
private void Open_Port_Click(object sender, EventArgs e)
{
if (RS485.Checked)
{
Open_Port_485();
}
else