You basically have to break down the loaded data into smaller chunks, and intersperse UI updates in between those bits of processing. The finer the granularity of the chunks of data you synchronously load / process, the more frequently your UI can update. In essence, poor man's multi-threading. (This is how it was done before the advent of multi-core machines.)
Breaking down into smaller chunks may well not be possible unless you do one or more of:
- Gut any system libraries for loading and substitute your own logic
- Restructure your data (possibly a major change).
So you'd do something like:
while (chunksRemaining > 0)
Notice that the
LoadNextChunk() call could take nanoseconds or whole seconds, but prevents us proceeding to
UpdateUI() until Chunk's processing is done. So ensure
LoadNextChunk() runs fast!