protected override void OnAfterWriteState(TwinCAT.Ads.StateInfo adsState, AdsErrorCode result)
 {
     if (result == AdsErrorCode.NoError)
     {
         this.setAdsState(adsState);
     }
 }
 private void OnAdsStateChanged(TwinCAT.Ads.StateInfo oldState, TwinCAT.Ads.StateInfo newState)
 {
     if (this.AdsStateChanged != null)
     {
         this.AdsStateChanged(this, new AdsStateChangedEventArgs2(newState, oldState, this._session));
     }
 }
 private void setAdsState(TwinCAT.Ads.StateInfo adsState)
 {
     TwinCAT.Ads.StateInfo info = this._adsState;
     if (!adsState.Equals(info))
     {
         object obj2 = this._synchronizer;
         lock (obj2)
         {
             this._adsState = adsState;
         }
         this.OnAdsStateChanged(info, this._adsState);
     }
 }
        private void OnError(AdsErrorCode error)
        {
            object obj2 = this._synchronizer;

            lock (obj2)
            {
                this._errorCount++;
                this._errorCountSinceLastAccess++;
                this._lastAccess = DateTime.UtcNow;
            }
            this.setState(TwinCAT.ConnectionState.Lost);
            TwinCAT.Ads.StateInfo adsState = new TwinCAT.Ads.StateInfo();
            this.setAdsState(adsState);
        }
 protected override void OnAfterDisconnect(AdsErrorCode errorCode)
 {
     if (errorCode != AdsErrorCode.NoError)
     {
         this.OnError(errorCode);
     }
     else
     {
         object obj2 = this._synchronizer;
         lock (obj2)
         {
             this._lastSucceeded             = DateTime.UtcNow;
             this._cycleCount                = 0;
             this._errorCountSinceLastAccess = 0;
             this._lastAccess                = this._lastSucceeded;
         }
         TwinCAT.Ads.StateInfo adsState = new TwinCAT.Ads.StateInfo();
         this.setAdsState(adsState);
         this.setState(TwinCAT.ConnectionState.Disconnected);
     }
 }