Exemplo n.º 1
0
        public void PollEvents()
        {
            while (raiseConnectionEvent > 0)
            {
                if (connected > 0)
                {
                    OnConnectionSucces?.Invoke();
                }
                else
                {
                    OnConnectionFailed?.Invoke();
                }

                Interlocked.Exchange(ref raiseConnectionEvent, 0);
            }

            if (raiseDisconnectEvent > 0)
            {
                OnDisconnect?.Invoke();
                Interlocked.Exchange(ref raiseDisconnectEvent, 0);
            }

            if (raiseTimeoutEvent > 0)
            {
                OnTimeout?.Invoke();
                Interlocked.Exchange(ref raiseTimeoutEvent, 0);
            }

            while (!pendingReceiveEvents.IsEmpty)
            {
                OnReceiveData?.Invoke(pendingReceiveEvents.Dequeue());
            }

            while (!pendingErrorEvents.IsEmpty)
            {
                OnError?.Invoke(pendingErrorEvents.Dequeue());
            }

            while (!pendingNetEntityCreatedEvent.IsEmpty)
            {
                KeyValuePair <NetEntity, byte[]> pair = pendingNetEntityCreatedEvent.Dequeue();
                OnNetEntityCreated?.Invoke(pair.Key, pair.Value);
            }

            while (!netEntityReceiveQueue.IsEmpty)
            {
                var pair = netEntityReceiveQueue.Dequeue();
                OnNetEntityReceiveData?.Invoke(pair.Key, pair.Value);
            }
        }
Exemplo n.º 2
0
    protected void RaiseErrorEvent(ErrorEventArgs e)
    {
        ErrorEventHandler eh = ErrorOccurred;

        if (eh != null)
        {
            eh.Invoke(this, e);
        }
    }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------------------
        private void errorOccured(object source, ErrorEventArgs args)
        {
            if (!(source is System.IO.FileSystemWatcher))
            {
                return;
            }

            onErrorOccured?.Invoke(source as System.IO.FileSystemWatcher, args);
        }
Exemplo n.º 4
0
        protected virtual void OnError(IntPtr converter, string errorText)
        {
            if (_log.IsTraceEnabled)
            {
                _log.Error("T:" + Thread.CurrentThread.Name + " Conversion Error: " + errorText);
            }

            ErrorEventHandler handler = Error;

            try
            {
                handler?.Invoke(this, errorText);
            }
            catch (Exception e)
            {
                _log.Warn("T:" + Thread.CurrentThread.Name + " Exception in Error event handler", e);
            }
        }
Exemplo n.º 5
0
 /// <devdoc>
 ///     Raises the event to each handler in the list.
 /// </devdoc>
 /// <internalonly/>
 private void NotifyInternalBufferOverflowEvent()
 {
     _onErrorHandler?.Invoke(this, new ErrorEventArgs(
                                 new InternalBufferOverflowException(SR.Format(SR.FSW_BufferOverflow, _directory))));
 }
Exemplo n.º 6
0
        public void AddError(string path, Exception error, DirectoryEntry parentDirectory)
        {
            ErrorEventHandler errorEventHandler = ErrorReceived;

            errorEventHandler?.Invoke(path, error, parentDirectory);
        }
Exemplo n.º 7
0
 private void FileSystemWatcher_Error(object sender, ErrorEventArgs e)
 {
     // bubble it up
     Error?.Invoke(this, e);
 }
Exemplo n.º 8
0
 private static void OnError(string error)
 {
     ErrorEventHandler?.Invoke(error);
 }
        protected void OnError(object sender, ErrorEventArgs args)
        {
            ErrorEventHandler onError = Error;

            onError?.Invoke(sender, args);
        }
Exemplo n.º 10
0
 private void RaiseError(Exception error) => _errorEvent?.Invoke(this, error);
Exemplo n.º 11
0
 private void RaiseError(PusherException error)
 {
     errorEvent?.Invoke(this, error);
 }