protected sealed override bool CloseConnection() { if (base.ConnectionState == PlcConnectionState.Disconnected) { return(true); } if (this.UnderlyingPlc is null) { return(true); } IAGLink4 plc = this.UnderlyingPlc; this.UnderlyingPlc = null; // Remove the handlers to the event-callbacks when the connection has been interrupted. plc.OnConnectionErrorOccured -= this.OnConnectionErrorOccurred; plc.OnConnectAborted -= this.OnConnectAborted; var result = plc.Disconnect(); plc.Dispose(); return(result); }
private void OnConnectAborted(IAGLink4 sender, ConnectionEventArgs args) => base.OnInterrupted(executeReconnect: true);