-
May 31st, 2013, 10:09 AM
#1
Thread Starter
Hyperactive Member
Progressbar for generating hash
Hi,
I wish to create a progress bar for my program to compute hashes like SHA1.
Currently if I were to generate the hash from a large file, the application will look as if it is hang particularly when user click inside the form.
I am not sure whether progressbar is a good solution that can help to solve this issue, or at least let user know know the current progress so that they will wait for the computation to complete.
I came across a few methods for coding progress bar which mostly is based on manual coding/calculation. I wonder is there an automatic way which will generate the progress bar based on the class/function that I use e.g. SHA1CryptoServiceProvider
Please advise.
Thanks
-
May 31st, 2013, 10:21 AM
#2
Addicted Member
Re: Progressbar for generating hash
Originally Posted by abcat
Hi,
I wish to create a progress bar for my program to compute hashes like SHA1.
Currently if I were to generate the hash from a large file, the application will look as if it is hang particularly when user click inside the form.
I am not sure whether progressbar is a good solution that can help to solve this issue, or at least let user know know the current progress so that they will wait for the computation to complete.
I came across a few methods for coding progress bar which mostly is based on manual coding/calculation. I wonder is there an automatic way which will generate the progress bar based on the class/function that I use e.g. SHA1CryptoServiceProvider
Please advise.
Thanks
A Progress bar would be your 2nd step, first look into using a Background Worker so your UI thread is free.
What is happening right now is your generating your Hash on the same thread as what your UI uses, so when the hash is being generated your UI is not able to work and redraw/function. So even if you put a progress bar it would not work.
Also instead of a progress bad showing total progress you could show the progress bar repeatedly going from 0 to 100 like some programs do
I am not well versed with background workers but perhaps someone else can chime in.
-
May 31st, 2013, 10:32 AM
#3
Lively Member
Re: Progressbar for generating hash
instead of a progress bar, something real simple that could let the user know it's working is change the cursor to the wait Me.Cursor = Cursors.WaitCursor then change it back to .default after it's complete.
Pat
-
May 31st, 2013, 10:34 AM
#4
Re: Progressbar for generating hash
I'd jsut use the progressbar in marquee mode... otherwise you have to figure out what the progression is... and unless the hash process reports how far along it is (unlikely) a traditional progbar that fills up isn't going to be accurate or easy to manage.
-tg
-
May 31st, 2013, 10:49 AM
#5
Thread Starter
Hyperactive Member
Re: Progressbar for generating hash
Based on all the responses, it is recommended for me to use a Background Worker so that my UI will not be 'hang' while computing. For the progress bar, I can use either a WaitCursor or ProgressBar (Marquee) to show just a loading indicator without any actual cacluation.
I guess this would be best and recommended way instead of going into the complex calculation.
Nevertheless, thanks for all the help
-
May 31st, 2013, 10:56 AM
#6
Re: Progressbar for generating hash
yyyyyup, that's it in a nutshell.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|