/// <summary> /// Raises the <see cref="LineReceived"/> event. /// </summary> /// <param name="sender">The <see cref="Serial"/> object that raised the event.</param> /// <param name="line">The received line of data.</param> protected virtual void OnLineReceivedEvent(Serial sender, string line) { if (this.onLineReceived == null) { this.onLineReceived = new LineReceivedEventHandler(this.OnLineReceivedEvent); } if (Program.CheckAndInvoke(this.LineReceived, this.onLineReceived, sender, line)) { this.LineReceived(sender, line); } }
/// <summary> /// Raises the <see cref="LineReceived"/> event. /// </summary> /// <param name="sender">The <see cref="Serial"/> object that raised the event.</param> /// <param name="line">The received line of data.</param> protected virtual void OnLineReceivedEvent(Serial sender, string line) { LineReceivedEventHandler handler = _lineReceivedHandler; if (handler == null) { return; } if (SynchronousUnsafeEventInvocation) { try { handler(sender, line); } catch { } } else { if (Program.CheckAndInvoke(handler, handler, sender, line)) { handler(sender, line); } } }