Form1.cs
1.7 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
{
private Asa.RFID.ReadAll read;
public Form1()
{
InitializeComponent();
}
PuYueRFID_C2S py;
private void Form1_Load(object sender, EventArgs e)
{
read = new Asa.RFID.ReadAll(new string[] {"192.168.3.7" },"log");
read.Type = Asa.RFID.DeviceType.PuYue;
//read.Start(10001);
//read.Start();
//read.Received += Read_Received;
py = new PuYueRFID_C2S("192.168.3.7");
//py.ID_Changed_Event += Py_ID_Changed_Event;
py.Open();
}
private void Py_ID_Changed_Event(object sender, string e)
{
this.Invoke((EventHandler)delegate
{
textBox1.Text += $"{(sender as PuYueRFID_C2S).IP}:{e}\r\n";
});
}
private void Read_Received(string ip, string id)
{
this.Invoke((EventHandler)delegate
{
textBox1.Text += $"{ip}:{id}\r\n";
});
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
read.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
int c= py.TryRead(out string id, out double ms);
textBox1.Text = $"{c},{id},{ms}";
}
}
}