Port_DataReceived is obviously an async event handler that is created by the port monitoring component thread.
there is a new thread for each delegate call?
No, probably not. The port monitoring component starts polling in the background thread, and an event is generated from this thread each time.
, , , Control.Invoke .
( post, - )
void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
UpdateTheUI(statusMsg);
}
private void UpdateTheUI(string statusMsg)
{
if (lblMsgResp.InvokeRequired)
{
lblMsgResp.BeginInvoke(new MethodInvoker(UpdateTheUI,statusMsg));
}
else
{
clsConnect(statusMsg);
}
}
, , .