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); } }
protected void RaiseErrorEvent(ErrorEventArgs e) { ErrorEventHandler eh = ErrorOccurred; if (eh != null) { eh.Invoke(this, e); } }
//------------------------------------------------------------------------------------- private void errorOccured(object source, ErrorEventArgs args) { if (!(source is System.IO.FileSystemWatcher)) { return; } onErrorOccured?.Invoke(source as System.IO.FileSystemWatcher, args); }
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); } }
/// <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)))); }
public void AddError(string path, Exception error, DirectoryEntry parentDirectory) { ErrorEventHandler errorEventHandler = ErrorReceived; errorEventHandler?.Invoke(path, error, parentDirectory); }
private void FileSystemWatcher_Error(object sender, ErrorEventArgs e) { // bubble it up Error?.Invoke(this, e); }
private static void OnError(string error) { ErrorEventHandler?.Invoke(error); }
protected void OnError(object sender, ErrorEventArgs args) { ErrorEventHandler onError = Error; onError?.Invoke(sender, args); }
private void RaiseError(Exception error) => _errorEvent?.Invoke(this, error);
private void RaiseError(PusherException error) { errorEvent?.Invoke(this, error); }