i want to implement download rate in my downloader .After googling found a rather complicated app Download manager - limit download speed.Then ,on another thread https://stackoverflow.com/questions/26073779/how-to-add-download-rate-and-limit-rate-in-downloader-in-c-sharp found a good suggestion:
Set up a timer which fires every second, and use a counter to record how many bytes have been downloaded, report the download rate as x Bytes/s in the timer Tick event, also reset the counter to zero
Just got on implementing this, using
bytesIn = int.Parse(e.BytesReceived.ToString());
totalBytes = int.Parse(e.TotalBytesToReceive.ToString());
I have bytesIn
in my code showing bytesreceived yet but how to implement the suggestion quoted above using timers as if i use a tick()
event and count it on every tick() event it won't show me my down-speed.
Suggestions please?