LEDModel.cs
1.08 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
using HHWCS.Bll;
using LEDhelp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HHWCSHost.Model
{
public class LEDModel
{
public LEDHelper LED { get; set; }
public Queue<string> InfoQueue { get; set; }
public void BeginSendInfo()
{
Task.Run(async () =>
{
if (LED != null && InfoQueue != null)
{
while (true)
{
await Task.Delay(2000);
if (InfoQueue.Count > 0)
{
int i = LED.SendLedInfo(InfoQueue.Dequeue());
Console.WriteLine("LED发送返回值:" + i);
if (i != 0)
{
LED = new LEDHelper(AppCommon.LedIP, AppCommon.LedPort, AppCommon.LedTimer);
}
}
}
}
});
}
}
}