Beispiel #1
0
 public ConnectionStateChangedEventArgs(ConnectionStateChangedReason reason, ConnectionState newState, ConnectionState oldState, System.Exception e)
 {
     this.Reason    = reason;
     this.OldState  = oldState;
     this.NewState  = newState;
     this.Exception = e;
 }
 protected virtual void OnConnectionStatusChanged(TwinCAT.ConnectionState oldState, TwinCAT.ConnectionState newState)
 {
     if (this.ConnectionStateChanged != null)
     {
         ConnectionStateChangedReason error = ConnectionStateChangedReason.Error;
         if ((newState == TwinCAT.ConnectionState.Connected) && ((oldState == TwinCAT.ConnectionState.Disconnected) || (oldState == TwinCAT.ConnectionState.None)))
         {
             error = ConnectionStateChangedReason.Established;
         }
         else if ((newState == TwinCAT.ConnectionState.Connected) && (oldState == TwinCAT.ConnectionState.Lost))
         {
             error = ConnectionStateChangedReason.Resurrected;
         }
         else if (newState == TwinCAT.ConnectionState.Lost)
         {
             error = ConnectionStateChangedReason.Lost;
         }
         else if (newState == TwinCAT.ConnectionState.Disconnected)
         {
             error = ConnectionStateChangedReason.Closed;
         }
         this.ConnectionStateChanged(this, new SessionConnectionStateChangedEventArgs(error, newState, oldState, this._session, this._session.Connection, null));
     }
 }
Beispiel #3
0
 public ConnectionStateChangedEventArgs(ConnectionStateChangedReason reason, ConnectionState newState, ConnectionState oldState) : this(reason, newState, oldState, null)
 {
 }
 public SessionConnectionStateChangedEventArgs(ConnectionStateChangedReason reason, ConnectionState newState, ConnectionState oldState, ISession session, IConnection connection) : this(reason, newState, oldState, session, connection, null)
 {
 }
 public SessionConnectionStateChangedEventArgs(ConnectionStateChangedReason reason, ConnectionState newState, ConnectionState oldState, ISession session, IConnection connection, Exception e) : base(reason, newState, oldState, e)
 {
     this.Session    = session;
     this.Connection = connection;
 }