Ejemplo n.º 1
0
        private void InvokeLogListener(LogListener aListener, bool aStart)
        {
            if (aListener != null)
            {
                aListener.OnStart    = new OnLogListenerEvent(this.OnLogListenerStart);
                aListener.OnStop     = new OnLogListenerEvent(this.OnLogListenerStop);
                aListener.OnNewEntry = new OnNewLogEntry(this.OnNewLogEntry);

                //lock (this.m_LogListeners)
                lock (this)
                {
                    this.m_LogListeners.Add(aListener);
                }

                if (aStart)
                {
                    aListener.StartListening();
                }
            }
        }
Ejemplo n.º 2
0
        public void CreateListeners()
        {
            if (this.m_Configuration != null)
            {
                ArrayList ls = this.m_Configuration.ListenerInstancesSettings;

                if (ls != null)
                {
                    foreach (ListenerInstanceSettings settings in ls)
                    {
                        LogListener listener = null;
                        switch (settings.Type)
                        {
                        case ListenerType.COMM:
                            listener = new LogListenerForSerialPort(settings.SerialPortSettings);
                            break;

                        case ListenerType.TCP:
                            break;

                        case ListenerType.UDP:
                            break;

                        default:
                            break;
                        }

                        if (listener != null)
                        {
                            listener.StationId = settings.StationId;
                            this.InvokeLogListener(listener, true);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void InvokeLogListener( LogListener aListener, bool aStart)
        {
            if (aListener != null)
            {
                aListener.OnStart = new OnLogListenerEvent(this.OnLogListenerStart);
                aListener.OnStop = new OnLogListenerEvent(this.OnLogListenerStop);
                aListener.OnNewEntry = new OnNewLogEntry(this.OnNewLogEntry);

                //lock (this.m_LogListeners)
                lock (this)
                {
                    this.m_LogListeners.Add(aListener);
                }

                if (aStart) aListener.StartListening();
            }
        }