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 / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

Backgroundworker show progress

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mcw.willart@interpolis.nl - 28 Jun 2007 20:16 GMT
Hi,

I use a backgroundworker to get the total size of a homeshare (as it
is a bit time-consuming). Wat i would like to do, is show the
progress, but at start i don't know how much files/folders will come
up, so i dont't know how to feed the progressbar (i believe i need to
know the maximum # of files to get a representative progress bar?).

Anyone has any ideas?

Kind regards,

Mario
The Netherlands
Peter Duniho - 28 Jun 2007 21:13 GMT
> I use a backgroundworker to get the total size of a homeshare (as it
> is a bit time-consuming). Wat i would like to do, is show the
> progress, but at start i don't know how much files/folders will come
> up, so i dont't know how to feed the progressbar (i believe i need to
> know the maximum # of files to get a representative progress bar?).

To show the user an accurate percentage completion, you need to know the  
total amount of work.  There's no way around that.

I don't know what it means to "get the total size of a homeshare" (what's  
a "homeshare"?), but if that involves traversing a directory structure and  
adding up file sizes or something like that, then yes...you can't  
accurately determine the total amount of work without doing the whole  
traversal.  At which point you could have simply finished the work already.

That said, you can do some things to "fake it".  One is to abandon the  
idea of showing progress per se.  Just show some indication of activity so  
that the user knows you're doing _something_.  Another option is to do a  
quick preliminary traversal, enumerating the first one or two directory  
levels, and then base your progress on that.  The relative progress could  
still wind up skewed if there is a huge difference in the work for each  
directory near the top level, but it's about the best you can do in this  
situation.  In most cases, it would provide pretty good feedback to the  
user.

Pete
mcw.willart@interpolis.nl - 29 Jun 2007 09:27 GMT
> That said, you can do some things to "fake it".  One is to abandon the  
> idea of showingprogressper se.  Just show some indication of activity so  
> that the user knows you're doing _something_.

Pete, thanks for your response. I decided to show an animated gif of a
progressbar during the time the backgroundworker is active, so users
will see some activity.

Greetings,

Mario

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.