I have a windows forms application where i add the mainloop in the constructor of the form like this:
Application.Idle += new EventHandler(Update);
that works fine - however, my update function is not called when I minimize the application window. What do I need to do in order to get my update function called also while the window is minimized?
You could call it from a System.Threading.Timer. Either start the Timer when you get minimized or just let it run (low frequency) and test for Minimized before calling Update.
Edit based on the comments
The most sensible way to do this is to run the
Updatecode from another thread. The Idle-event or Timer solutions will both run into problems.But with a thread you have to be careful when touching any UI Control. A simple approach is the BackgroundWorker. It has Completed and Progress events that are executed thread-safe.