serialPort.cs
3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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 Dal;
using Comm;
using MachineDll;
namespace serialPortSoft
{
public partial class serialPort : Form
{
#region 定义
private double washTime;
private double testTime;
private readonly Fuction fuction = new Fuction();
private TheMachine theMachine;
#endregion
public serialPort()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
PortSetting ps = new PortSetting();
ps.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
this.groupBox1.ForeColor = Color.Gray;
this.label1.ForeColor = Color.Gray;
this.label2.ForeColor = Color.Gray;
this.textBox1.ForeColor = Color.Gray;
this.textBox2.ForeColor = Color.Gray;
this.button4.ForeColor = Color.Gray;
this.button5.ForeColor = Color.Gray;
this.button6.ForeColor = Color.Gray;
this.button7.ForeColor = Color.Gray;
this.button8.ForeColor = Color.Gray;
this.button9.ForeColor = Color.Gray;
this.button10.ForeColor = Color.Gray;
}
private void button2_Click(object sender, EventArgs e)
{
this.groupBox1.ForeColor = Color.Black;
this.label1.ForeColor = Color.Black;
this.label2.ForeColor = Color.Black;
this.textBox1.ForeColor = Color.Black;
this.textBox2.ForeColor = Color.Black;
this.button5.ForeColor = Color.Black;
this.button6.ForeColor = Color.Black;
this.button8.ForeColor = Color.Black;
this.button10.ForeColor = Color.Black;
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
/**
* 清洗功能
*/
private void button5_Click(object sender, EventArgs e)
{
this.button4.ForeColor = Color.Gray;
this.button7.ForeColor = Color.Black;
this.button9.ForeColor = Color.Black;
try
{
theMachine.GetControllor.OpenY1();
System.Threading.Thread.Sleep(1500);
theMachine.GetControllor.OpenY2();
System.Threading.Thread.Sleep(1500);
theMachine.GetControllor.CloseY0();
this.button6.Text = "正常";
}catch(Exception ex){
this.button6.Text = "异常";
}
}
/**
* 过滤功能
*/
private void button8_Click(object sender, EventArgs e)
{
this.button4.ForeColor = Color.Black;
this.button7.ForeColor = Color.Gray;
this.button9.ForeColor = Color.Black;
try
{
theMachine.GetControllor.CloseY1();
System.Threading.Thread.Sleep(1500);
theMachine.GetControllor.OpenY2();
System.Threading.Thread.Sleep(1500);
theMachine.GetControllor.OpenY0();
this.button6.Text = "正常";
}
catch
{
this.button6.Text = "异常";
}
}
}
}