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;
namespace PortW
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.btn_Close.Enabled = false;
}
public Port port { get; set; }
public string stopStr = "FF 01 00 00 00 00 01";
public string GOpenStr = "FF 01 02 00 00 00 03";
public string GCloseStr = "FF 01 04 00 00 00 05";
public string BOpenStr = "FF 01 00 40 00 00 41";
public string BCloseStr = "FF 01 00 20 00 00 21";
public string JOpenStr = "FF 01 00 80 00 00 81";
public string JCloseStr = "FF 01 01 20 00 00 02";
private void btn_Open_Click(object sender, EventArgs e)
{
port = new Port(tb_COM.Text);
if (port.Open())
{
this.btn_Close.Enabled = true;
this.btn_Open.Enabled = false;
}
else
MessageBox.Show("NO");
}
private void btn_Close_Click(object sender, EventArgs e)
{
port.Close();
this.btn_Open.Enabled = true;
this.btn_Close.Enabled = false;
}
private void btn_Send_Click(object sender, EventArgs e)
{
if (cb_Opertaor.Checked)
{
if (port!=null)
{
port.Send_data(tb_send.Text);
}
}
}
private void Button1_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(GOpenStr);
}
else
{
tb_send.Text = GOpenStr;
}
}
private void Button2_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(GCloseStr);
}
else
{
tb_send.Text = GCloseStr;
}
}
private void Button4_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(BOpenStr);
}
else
{
tb_send.Text = BOpenStr;
}
}
private void Button3_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(BCloseStr);
}
else
{
tb_send.Text = BCloseStr;
}
}
private void Button6_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(JOpenStr);
}
else
{
tb_send.Text = JOpenStr;
}
}
private void Button5_MouseDown(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(JCloseStr);
}
else
{
tb_send.Text = JCloseStr;
}
}
private void Button5_MouseLeave(object sender, EventArgs e)
{
}
private void button7_Click(object sender, EventArgs e)
{
tb_send.Text = stopStr;
}
private void Button5_MouseLeave(object sender, MouseEventArgs e)
{
if (!cb_Opertaor.Checked)
{
if (port != null)
port.Send_data(stopStr);
}
}
}
}
资源文件列表
Port/.vs/Port/v14/.suo , 48640
Port/Port/App.config , 188
Port/Port/bin/Debug/Port.exe , 12800
Port/Port/bin/Debug/Port.exe.config , 188
Port/Port/bin/Debug/Port.pdb , 32256
Port/Port/bin/Debug/Port.vshost.exe , 22696
Port/Port/bin/Debug/Port.vshost.exe.config , 188
Port/Port/bin/Debug/Port.vshost.exe.manifest , 490
Port/Port/bin/Debug/Port.xml , 651
Port/Port/Form1.Designer.vb , 1262
Port/Port/Form1.resx , 5817
Port/Port/Form1.vb , 115
Port/Port/Form2.Designer.vb , 1268
Port/Port/Form2.resx , 5817
Port/Port/Form2.vb , 34
Port/Port/Form3.Designer.vb , 1067
Port/Port/Form3.vb , 34
Port/Port/My Project/Application.Designer.vb , 1486
Port/Port/My Project/Application.myapp , 510
Port/Port/My Project/AssemblyInfo.vb , 1037
Port/Port/My Project/Resources.Designer.vb , 2771
Port/Port/My Project/Resources.resx , 5612
Port/Port/My Project/Settings.Designer.vb , 2971
Port/Port/My Project/Settings.settings , 279
Port/Port/obj/Debug/DesignTimeResolveAssemblyReferences.cache , 1013
Port/Port/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache , 6985
Port/Port/obj/Debug/Port.exe , 12800
Port/Port/obj/Debug/Port.Form1.resources , 180
Port/Port/obj/Debug/Port.pdb , 32256
Port/Port/obj/Debug/Port.Resources.resources , 180
Port/Port/obj/Debug/Port.vbproj.FileListAbsolute.txt , 589
Port/Port/obj/Debug/Port.vbproj.GenerateResource.Cache , 1012
Port/Port/obj/Debug/Port.vbprojResolveAssemblyReference.cache , 2086
Port/Port/obj/Debug/Port.xml , 651
Port/Port/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll , 6144
Port/Port/port/Laser.cs , 6731
Port/Port/Port.vbproj , 5964
Port/Port.sln , 982
Port/PortW/App.config , 189
Port/PortW/bin/Debug/PortW.exe , 15872
Port/PortW/bin/Debug/PortW.exe.config , 189
Port/PortW/bin/Debug/PortW.pdb , 32256
Port/PortW/bin/Debug/PortW.vshost.exe , 22696
Port/PortW/bin/Debug/PortW.vshost.exe.config , 189
Port/PortW/bin/Debug/PortW.vshost.exe.manifest , 490
Port/PortW/Form1.cs , 4223
Port/PortW/Form1.Designer.cs , 10700
Port/PortW/Form1.resx , 5817
Port/PortW/obj/Debug/DesignTimeResolveAssemblyReferences.cache , 1464
Port/PortW/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache , 7100
Port/PortW/obj/Debug/PortW.csproj.FileListAbsolute.txt , 448
Port/PortW/obj/Debug/PortW.csproj.GenerateResource.Cache , 1012
Port/PortW/obj/Debug/PortW.exe , 15872
Port/PortW/obj/Debug/PortW.Form1.resources , 180
Port/PortW/obj/Debug/PortW.pdb , 32256
Port/PortW/obj/Debug/PortW.Properties.Resources.resources , 180
Port/PortW/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs , 0
Port/PortW/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs , 0
Port/PortW/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs , 0
Port/PortW/Port/Laser.cs , 6747
Port/PortW/PortW.csproj , 3949
Port/PortW/Program.cs , 517
Port/PortW/Properties/AssemblyInfo.cs , 1318
Port/PortW/Properties/Resources.Designer.cs , 2823
Port/PortW/Properties/Resources.resx , 5612
Port/PortW/Properties/Settings.Designer.cs , 1092
Port/PortW/Properties/Settings.settings , 249
