Quick question concerning communication between arduino boards and a c# winforms application. Basically what I did so far is something like
_serialPort = new SerialPort();
...
_serialPort.Open();
...
_serialPort.DataReceived += OnReceived;
...
private static void OnReceived(object sender, SerialDataReceivedEventArgs c)
{
// Do something
}
This works as long I put this in the Main-Thread of the application. My question is would it be possible to write a class, that does the same as the code above (listening to the communication via serialport) in a background-thread.