I have a class that needs to have properties updated with data from the C# serial DataReceived event.
I’m not trying to update a UI, but the only references I find about using the results of the DataReceived event (which runs on a different thread) say to use .Invoke to get the data into a UI control. My class is not associated with a UI so .Invoke is not available.
When the handler tries to change a property in the class, I get the dreaded error: “The calling thread cannot access this object because a different thread owns it.”
What is process for getting the results into the parent thread?
If you don’t want to provide UI reference all the way up to DAL then you can take this approach using the SynchronizationContext.