A
aaronj1335
I am trying to write an application that controls a robot via a
serial
port. I made a robot class that includes the serial port over which
I
send commands, and I would like to be able to have two different
threads for the GUI and for the loop that sends commands to the
robot,
but I am having trouble communicating between the threads. Right
now
I am trying to get the GUI thread to raise an event when the user
sends a command that the robot thread needs to handles, and the robot
thread to raise an event when the robot sends anything over the
serial
port or finishes a command that the GUI thread needs to respond to. I
would like to know if this is the best implementation and what I will
need to do as far as delegates between the two threads. I would use
a
BackgroundWorker, but I need to be able to send commands to the
BackgroundWorker while it is working, which does not seem to be what
it is designed for. Any help would be greatly appreciated, thanks.
serial
port. I made a robot class that includes the serial port over which
I
send commands, and I would like to be able to have two different
threads for the GUI and for the loop that sends commands to the
robot,
but I am having trouble communicating between the threads. Right
now
I am trying to get the GUI thread to raise an event when the user
sends a command that the robot thread needs to handles, and the robot
thread to raise an event when the robot sends anything over the
serial
port or finishes a command that the GUI thread needs to respond to. I
would like to know if this is the best implementation and what I will
need to do as far as delegates between the two threads. I would use
a
BackgroundWorker, but I need to be able to send commands to the
BackgroundWorker while it is working, which does not seem to be what
it is designed for. Any help would be greatly appreciated, thanks.