Backgroudworker question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, friends,

I am using BackgroundWorker() to import files into viewer while users are
working with our app.

However, this backgroud file importing made the app much slower. For
instance, it took about 5 seconds for the app window to refresh. Moreover,
most of the time, the mouse pointer is a hourglass, not the default arrow.

I was hoping this background file importing was a silent one, i.e., our
users should NOT notice this thread is running.

Any ideas, reference papers, sample source code, and etc.? Was this the
right approach for my purpose?

Thanks a lot for your help!
 
I am using BackgroundWorker() to import files into viewer while users are
working with our app.

However, this backgroud file importing made the app much slower.

What "viewer"? Something of your own design? Some built-in class? How
does the background thread add data to the viewer? Does the user interact
with the viewer as the work is done?

You don't offer much in the way of details, but if you are simply adding
one item at a time from the background thread to some UI component in the
foreground, then it doesn't surprise me that the operation takes longer
and that the UI component is still somewhat unresponsive. That said, if
you want feedback to the user in the way of items being added to the
viewer as progress is made, this may be unavoidable to some extent.

You could mitigate the issue by batching items up. Let some number of
results accumulate before you actually add them to the viewer, and disable
updates for the viewer while they are being added. If having the items
show up as they are found isn't important, then the best solution would
probably be to just keep the list of items somewhere until the operation
is done and then add them to the viewer all at once (or maybe even add
them to a hidden viewer and swap that in for the displayed on once
everything's been added).

Pete
 
Andrew said:
I am using BackgroundWorker() to import files into viewer while users are
working with our app.

However, this backgroud file importing made the app much slower. For
instance, it took about 5 seconds for the app window to refresh. Moreover,
most of the time, the mouse pointer is a hourglass, not the default arrow.

I was hoping this background file importing was a silent one, i.e., our
users should NOT notice this thread is running.

Any ideas, reference papers, sample source code, and etc.? Was this the
right approach for my purpose?

I'd like to see *your* source code - or rather, a short but complete
program demonstrating the problem. My guess is that you're not using
BackgroundWorker properly, but it's impossible to say without seeing
some code.
 
Back
Top