Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2007

Tip: Looking for answers? Try searching our database.

Backgroudworker question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew - 07 May 2007 15:53 GMT
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!
Peter Duniho - 07 May 2007 19:13 GMT
> 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
Jon Skeet [C# MVP] - 07 May 2007 19:17 GMT
> I am using BackgroundWorker() to import files into viewer while users are
> working with our app.
[quoted text clipped - 8 lines]
> 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.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.