コード例 #1
0
        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);
        }
コード例 #2
0
 private void OnConnectAborted(IAGLink4 sender, ConnectionEventArgs args)
 => base.OnInterrupted(executeReconnect: true);