dep_yangw
我叫锄头 10 months ago
parent 7962380612
commit 29f7515f53

@ -9,6 +9,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
using NewLife.Threading;
namespace ProductionSystem.Untils.Tool
{
@ -112,27 +113,30 @@ namespace ProductionSystem.Untils.Tool
return me.GetByteDat().ToHex();
}
private TimerX _timer;
public void Send()
{
var sendMes = GetMsg(mo);
_timer= new TimerX(DoBackup, sendMes, 100, 800) { Async = true };
Task.Run(() =>
{
while (!Exit)
{
mfSerialInfo.SendMessage(sendMes);
}
});
private void DoBackup(Object state)
{
XTrace.WriteLine("Ux定时器");
mfSerialInfo.SendMessage(state.ToString());
}
public bool Exit { get; set; }
public void closeSend()
{
Exit = true;
_timer.Dispose();
_timer = null;
Thread.Sleep(600);
var sendMes = GetMsg(0);
for (int i = 0; i < 100; i++)
{

@ -110,13 +110,14 @@ namespace ProductionSystem.Untils.Tool
{
var sendMes = GetMsg(mo);
_timer= new TimerX(DoBackup, sendMes, 100, 500) { Async = false };
_timer= new TimerX(DoBackup, sendMes, 100, 800) { Async = true };
}
private void DoBackup(Object state)
{
XTrace.WriteLine("Uy定时器");
mfSerialInfo.SendMessage(state.ToString());
}

Loading…
Cancel
Save