private void SendLabel(ModbusPkt pkt) { SendRetrieveXML send = new SendRetrieveXML(MB); send.Log += Modbus_Log; try { send.SendXML(pkt.Label); } finally { AsyncComplete ac = new AsyncComplete(MB, pkt); parent.BeginInvoke(new EventHandler(delegate { Complete(this, ac); })); send.Log -= Modbus_Log; send = null; } }
private void Send(ModbusPkt pkt) { SendRetrieveXML send = new SendRetrieveXML(MB); send.Log += Modbus_Log; try { send.SendXML(pkt.Data); } finally { string logXML = send.LogXML; AsyncComplete ac = new AsyncComplete(MB, pkt) { Resp2 = logXML }; parent.Invoke(new EventHandler(delegate { Complete(this, ac); })); send.Log -= Modbus_Log; send = null; } }