C# GUI Seperation
Hi!
I have been using C# for a while and am having trouble coming up with a good model for GUI interaction. In most programs I write I need to spawn new threads because I find that networking code is unrealiable otherwise. Those threads need to check InvokeRequired and Invoke controls to do their updating in their own time. This is extremely cumbersome for each control that needs updating! I don't want to use a BackgroundWorker because I don't have one or two long-running processes - I want my whole backend running in it's own thread.
What I end up doing now mostly is having a global (static) object where I mirror data presented on the GUI. The GUI runs a timer and copies that data to the controls. The backend objects update the static object. This seems like an easy way to do things but it's not nice to have global data, and the duplication of data between the GUI and the static object also does not feel right.
Can anyone comment on the best way to run a rich GUI, with everything else on another thread, and the communication between the two?
Leslie Viljoen
|