Threads, progress bars and PDAs

  • Thread starter Thread starter Murray Foxcroft
  • Start date Start date
M

Murray Foxcroft

Hi

I have a PDA that will run an application launch program. This little
program will check a web service to see if an update is available and if it
is, will download it.

Now, this works on the emulator that comes with VS.Net 2003 (Pocket PC 2003
Emulator), well mostly! It uses a progress bar (which works in a dissociated
manner with a System.Windows.Forms.Timer). The timer fires once a second and
updates the progress bar by one. This happens while the web service runs
asynchonously to determine update status, etc. When the web service returns,
it updates the progress bar to full, i.e. set the value to the maximum.
After that, it uses the same progress bar to show it's progress in
downloading an update. This works - mostly - in the emulator. I say mostly
as sometimes it seems to need a hard-reset before it will run again. But
this isn't the issue.

The issue is: When it is running on the actual device, the progress bar
locks up after a few seconds, and the whole app seems to hang. I cannot
replicate this situation in the emulator. It is possible that there is a
timing issue, or threading issue with my main UI thread and the progress
bar?

Many thanks
Jase
 
It's becasue you should *never* affect the UI thread from a worker thread
directly. This is also the case in the full framework, so it's a bit
surprising it's worked there. Google Control.Invoke to see how it should be
done.

-Chris
 
Back
Top