On Sat, 21 Jul 2007 02:29:12 -0700, Marc Gravell
<ma**********@gmail.comwrote:
>Simple - don't do that work on the UI thread, but instead fire up a
worker thread - perhaps using BackgroundWorker or ThreadPool. The UI
thread simply starts the work going, then goes back to processing
messages. The only complexity is that the worker thread *cannot* talk
directly to the Controls (thread affinity; both read & write), so must
instead ask the UI thread for a little help, via Control.Invoke (sync)
and Control.BeginInvoke (async)
Thanks, Marc. I was afraid you were going to say that. <g>
This particular stretch of code may take a lot of work to run it on
another thread. In other programs I've used Invoke for access to UI
threads, but this one won't go quietly.
In this case I'm triggering the CPU-hog process via a button. It
updates values that are polled by a dispatch loop on a
System.Forms.Timer (which runs in the UI thread). Some UI controls
DO update. Text in TextBoxes does not. Also Button events don't
propagate back.
Given that some of the controls do work, I was hoping that there was a
way to delegate enough CPU to get the others working too.
No other solution except another thread, eh?