private void RaiseSessionClosedEvent(SessionCloseReason reason, Exception ex) { if (SessionClosed == null) { return; } foreach (EventHandler <TcpIpSessionClosedEventArgs> del in SessionClosed.GetInvocationList()) { SessionClosed.BeginInvoke(this, new TcpIpSessionClosedEventArgs(reason, ex), AsyncCallBackRaiseSessionClosedEvent, del); } }
private void RaiseSessionClosedEvent(SessionCloseReason reason, Exception ex) { if (SessionClosed == null) { return; } foreach (EventHandler <TcpIpSessionClosedEventArgs> del in SessionClosed.GetInvocationList()) { #if NET40 SessionClosed.BeginInvoke(this, new TcpIpSessionClosedEventArgs(reason, ex), AsyncCallBackRaiseSessionClosedEvent, del); #else System.Threading.Tasks.Task.Run(() => SessionClosed.Invoke(this, new TcpIpSessionClosedEventArgs(reason, ex))); #endif } }
protected virtual void OnSessionClosed(Guid e) { SessionClosed?.BeginInvoke(this, e, EndInvokeGuid, SessionClosed); }