ArtemisComm.PacketProcessing.OnEvent C# (CSharp) Method

OnEvent() protected method

protected OnEvent ( EventHandler handler, ConnectionEventArgs e ) : void
handler EventHandler
e ConnectionEventArgs
return void
        protected virtual void OnEvent(EventHandler<ConnectionEventArgs> handler, ConnectionEventArgs e)
        {

            if (handler != null)
            {
                foreach (EventHandler<ConnectionEventArgs> singleCast in handler.GetInvocationList())
                {
                    ISynchronizeInvoke syncInvoke = singleCast.Target as ISynchronizeInvoke;
                    try
                    {
                        //This code is to make the raising of the event threadsafe with the UI thread.
                        if (syncInvoke != null && syncInvoke.InvokeRequired)
                        {
                            syncInvoke.BeginInvoke(singleCast, new object[] { this, e });
                        }
                        else
                        {
                            singleCast(this, e);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (CrashOnException)
                        {
                            throw;
                        }
                        else
                        {
                            if (e != null)
                            {
                                RaiseExceptionEncountered(ex, e.ID);
                            }
                            else
                            {
                                RaiseExceptionEncountered(ex, Guid.Empty);
                            }
                        }
                    }
                }

            }
        }
        protected virtual void OnEvent(EventHandler<ExceptionEventArgs> handler, ExceptionEventArgs e)

Same methods

PacketProcessing::OnEvent ( EventHandler handler, ExceptionEventArgs e ) : void
PacketProcessing::OnEvent ( EventHandler handler, PackageEventArgs e ) : void