|
|
|
@ -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++)
|
|
|
|
|
{
|
|
|
|
|