예제 #1
0
 public void OnSyncRouterNotification(AmsRouterState state)
 {
     if (this._iNoteReceiver != null)
     {
         this._iNoteReceiver.OnRouterNotification(state);
     }
 }
예제 #2
0
        private void UpdateRouterState()
        {
            bool enabled = false;

            if (!base._disposed)
            {
                try
                {
                    if (this.AmsPortEnabled(false, out enabled) == AdsErrorCode.NoError)
                    {
                        if (enabled)
                        {
                            this._routerState = AmsRouterState.Start;
                        }
                        else
                        {
                            StateInfo    info;
                            AdsErrorCode code = this.ReadState(false, out info);
                            this._routerState = AmsRouterState.Stop;
                            if (code == AdsErrorCode.PortNotConnected)
                            {
                                this._routerState = AmsRouterState.Removed;
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    Module.Trace.TraceError(exception);
                }
            }
        }
예제 #3
0
 public void PostRouterNotification(AmsRouterState state)
 {
     if (this.syncMsgReceiver != null)
     {
         object[] objArray1 = new object[] { state };
         base.BeginInvoke(this.routerNotificationDelegate, objArray1);
     }
 }
예제 #4
0
 private void _routerNotificationTimer_Tick(object sender, EventArgs e)
 {
     if (!this._routerNotificationsRegistered)
     {
         AmsRouterState state = this._routerState;
         this.UpdateRouterState();
         if (state != this._routerState)
         {
             this.OnRouterNotification(this._routerState);
         }
     }
 }
예제 #5
0
 public void OnRouterNotification(AmsRouterState state)
 {
     if (!base._disposed)
     {
         if (!this._bSynchronize)
         {
             this.OnSyncRouterNotification(state);
         }
         else if (this._routerSyncWindow != null)
         {
             this._routerSyncWindow.PostRouterNotification(state);
         }
     }
 }
예제 #6
0
        public void OnRouterNotification(AmsRouterState state)
        {
            IList <WeakReference> list = null;
            object obj2 = s_instLock;

            lock (obj2)
            {
                this._routerState = state;
                list = new List <WeakReference>(this._syncPortDict.Values);
            }
            try
            {
                foreach (WeakReference reference in list)
                {
                    if (!reference.IsAlive)
                    {
                        continue;
                    }
                    TcAdsSyncPort target = (TcAdsSyncPort)reference.Target;
                    if (target != null)
                    {
                        if (!target.IsDisposed)
                        {
                            target.OnRouterNotification(this._routerState);
                            continue;
                        }
                        string message = $"SyncPort '{target.Id}' is already disposed!";
                        Module.Trace.TraceWarning(message);
                    }
                }
            }
            catch (Exception exception)
            {
                Module.Trace.TraceError(exception);
            }
        }
 public AmsRouterNotificationEventArgs(AmsRouterState state)
 {
     this.state = state;
 }
예제 #8
0
 private void _connection_AmsRouterNotification(object sender, AmsRouterNotificationEventArgs e)
 {
     AmsRouterState state = e.State;
 }