|
-
May 7th, 2009, 04:03 AM
#1
Update Progess File
Hello to all, i have create a downloader in C# using downloadFile() method and i would like to get the progress percentage into progress bar.
I using downloadFile() and not using native stream object.
Any code is welcome.
Thanks.
Thanks for your help.
-
May 7th, 2009, 08:21 AM
#2
Re: Update Progess File
 Originally Posted by Peter_APIIT
Hello to all, i have create a downloader in C# using downloadFile() method and i would like to get the progress percentage into progress bar.
I using downloadFile() and not using native stream object.
Any code is welcome.
Thanks.
What is downloadFile() method coming from ?
Is this a third Party dll or which namespace is used there ?
Are you using a backgroundworker ? During Download is there any possibility to get an event fired which updates your progress bar ?
Is this a WinForm or a WebApplication ? Using ADO or Linq ?
You see there are much questions left Please give more data.
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
May 8th, 2009, 03:19 AM
#3
Re: Update Progess File
What is ownloadFile() method coming from ?
From system.Net.WebClient class.
Is this a third Party dll or which namespace is used there ?
M$ library.
Are you using a backgroundworker ? During Download is there any possibility to get an event fired which updates your progress bar ?
I want it using backGroundworker. Yes, i want some event to update my progress bar in background to avoid my application get starvation.
Is this a WinForm or a WebApplication ? Using ADO or Linq ?
You see there are much questions left Please give more data.
Winform and not WPF.
I not using stream to calculate the file size. Is there any method ?
Thanks.
Thanks for your help.
-
May 8th, 2009, 08:18 AM
#4
Re: Update Progess File
Have you looked at the methods and events associated with the webclient class? I don't see any methods or properties that will tell you the size of the file your downloading. I don't have much experience with that class. So I may have missed something.
-zd
-
May 8th, 2009, 08:27 AM
#5
Re: Update Progess File
if you're using the WebClient class it's very easy to display progress, you can handle for exaple this event DownloadProgressChanged
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 8th, 2009, 08:42 AM
#6
Re: Update Progess File
If i am not mistaken the downloadprogresschanged event is only fired with the DownloadfileAsync method. However even when wired up to the downloadprogresschanged event I don't think you would have any way of knowing what the total size of the file was so your progress bar would just have to be constantly moving. Which is OK....I guess.
That is to the best of my knowledge....
-zd
-
May 8th, 2009, 08:45 AM
#7
Re: Update Progess File
the DownloadProgressChangedEventArgs returns everything one could need
http://msdn.microsoft.com/en-us/libr...s_members.aspx
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 8th, 2009, 09:01 AM
#8
Re: Update Progess File
memeloo is correct the DownloadProgressChangedEventArgs class does provide all information needed. However, the link memeloo provided was for the System.Deployment.Application namespace. The DownloadProgressChangeEvent args class we need is in the system.net namespace located here:
http://msdn.microsoft.com/en-us/libr...s_members.aspx
Also this event is only triggered when the DownloadFileAsync method is used. In our case we are using the DownloadFile method.
However, if Peter decided to use the DownloadFileAsync memeloo is absolutely correct.
-zd
-
May 8th, 2009, 09:17 AM
#9
Re: Update Progess File
oh I'm sorry for the wrong link, sure, zdavis' link is the correct one of course, I just googled for DownloadProgressChangedEventArgs and didn't see that this is the wrong namespace
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 8th, 2009, 09:20 AM
#10
Re: Update Progess File
@memeloo - I figured that was the issue. I learned a lot from this post. especially on that event args class...
Good Post
-
May 9th, 2009, 03:53 AM
#11
Re: Update Progess File
I decided to using DownloadFileAsync.
Does anyone have code for DownloadProgressChanged and DownloadFileComplete ?
Thanks.
Thanks for your help.
-
May 15th, 2009, 11:21 PM
#12
Re: Update Progess File
Does anyone have sample code for this topic ?
Thanks.
Thanks for your help.
-
May 18th, 2009, 09:07 AM
#13
Re: Update Progess File
Are you having troubles with it?
-zd
-
May 18th, 2009, 09:33 AM
#14
Re: Update Progess File
you don't like msdn, do you? there are some samples
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
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
|