private void RaiseSessionClosedEvent(SmppSessionCloseReason reason, Exception exception) { if (SessionClosed == null) { return; } SmppSessionClosedEventArgs e = new SmppSessionClosedEventArgs(reason, exception); foreach (EventHandler <SmppSessionClosedEventArgs> del in SessionClosed.GetInvocationList()) { del.BeginInvoke(this, e, AsyncCallBackRaiseSessionClosedEvent, del); } }
private void RaiseSessionClosedEvent(SmppSessionCloseReason reason, Exception exception) { if (SessionClosed == null) { return; } SmppSessionClosedEventArgs e = new SmppSessionClosedEventArgs(reason, exception); foreach (EventHandler <SmppSessionClosedEventArgs> del in SessionClosed.GetInvocationList()) { #if NET40 del.BeginInvoke(this, e, AsyncCallBackRaiseSessionClosedEvent, del); #else System.Threading.Tasks.Task.Run(() => del.Invoke(this, e)); #endif } }