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;
using System.IO;
using System.IO.Ports;
using System.Threading;
using DevExpress.XtraEditors;
using System.Text.RegularExpressions;
namespace WindowsFormsApplication3
{
public partial class Form1 : XtraForm
{
SerialPort sp1 = new SerialPort();
int Flag = 0;
int StateChanged = 0;