private void Disconnect(ModbusPkt pkt) { MB.Disconnect(); AsyncComplete ac = new AsyncComplete(MB, pkt) { Success = true }; parent.Invoke(new EventHandler(delegate { Complete(this, ac); })); }
private void Reconnect() { try { m_Modbus.Disconnect(); Thread.Sleep(200); m_Modbus.Connect(); } catch (Exception ex) { log.AddERRORLOG(string.Format("重连异常:{0}\r\n{1}", ex.Message, ex.StackTrace)); } }
public override bool Disconnect() { try { Modbus?.Disconnect(); Status = Stav.Offline; return(true); } catch (Exception exception) { var zarizeniArgs = new ZarizeniArgs(Status, Ping, $"!CHYBA!", exception); OnStatusChanged(zarizeniArgs); return(false); } }
private Task Disconnect() { _client = Modbus.Disconnect(_client); return(Task.CompletedTask); }