private void FrameReceivedEventHandler(object o, FrameReceivedEventArgs a) { if ((a.Frame.MailboxId & 0xff) == mBlockId) { ProcessChunk(a.Frame); } }
/// <summary> /// Event firing method. /// </summary> /// <param name="frame">The CAN frame just received.</param> protected virtual void OnRaiseFrameReceivedEvent(FrameReceivedEventArgs frameEvent) { //ThreadPool.QueueUserWorkItem((o) => //{ // // copy the event handler to avoid mid process subscribe/un-subscribe // EventHandler<FrameReceivedEventArgs> handler = RaiseFrameReceivedEvent; // // Check if there are any Subscribers // if (handler != null) // { // // Call the Event // handler(this, frameEvent); // } //} //); EventHandler <FrameReceivedEventArgs> handler = RaiseFrameReceivedEvent; if (handler != null) { // Call the Event handler(this, frameEvent); } }