I am unsure how to approach a C# windows App.
Essentially I want to do this.
I want to write an app that reads from database_A performs some calculations
updates the pretty dials on the screen then writes the 'cooked' data to
database_B (probably not in that order).
Also I will have some buttons on this main window that open some other
winforms so I can capture other bits of info and adjust the main window's
pretty dials and textboxes accordingly.
Being new to C# ( and very rusty at windows apps ) I found the wonderful
drag-and-drop timer double clicked it and low and behold a timer1_Tick event
appeared, wonderful thought I, I'll just put my database reads and screen
update calls in here.
But alas as was kindly pointed out to me every thing is running on a single
thread and while the app patiently waits for these DB calls and whatever
else I've piled into this event (timer1_Tick ) the main window (buttons,
dials etc) sit there completely unresponsive. I've never tried to make this
sort of 'polling' app before the closest I came was making my child windows
non-modal so they didn't freeze up the parent.
So how would more experienced C# programmer approach this at a high level.
the horrid words 'multi-threading' leap to my mind ...
Would it be wise to continue to run the timer on UI thread but each
timer_tick event start a separate thread to read/write the database and
perhaps when that thread has completed create a new thread to update my
screen. Ah bah humbug I really have no clue.
A starting point would be much appreciated ... Google and the beginners
guide to threading will help me with the rest. :-)
regards Bob.