FrmMain.cs
1.3 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
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 Clinet;
namespace ClientTest
{
public partial class FrmMain : Form
{
private AgvClient client;
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
client = new AgvClient("127.0.0.1");
client.Connect();
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
client.Close();
}
private void BtnAdd_Click(object sender, EventArgs e)
{
string idx = (sender as Button).Name.Substring(6, 1);
string name = Controls["TxtName" + idx].Text;
string mark = Controls["TxtMark" + idx].Text;
string rfid = Controls["TxtRfid" + idx].Text;
ClientAction action = (ClientAction)((ComboBox)Controls["CboAction" + idx]).SelectedIndex;
ClientLevel level = (ClientLevel)((ComboBox)Controls["CboLevel" + idx]).SelectedIndex;
client.SetStatus(name, mark, rfid, action, level);
}
}
}