12/8/2022 0 Comments Silverlight download file stream![]() ![]() Void client_OpenReadCompleted( object sender, OpenReadCompletedEventArgs e) TextBlock2.Text = e.ProgressPercentage + "% done " + e.BytesReceived + " bytes received and " + e.TotalBytesToReceive + " bytes still needed." ProgressBar1.Value = e.ProgressPercentage Void client_DownloadProgressChanged( object sender, DownloadProgressChangedEventArgs e) RelativeOrAbsolute) Ĭlient.OpenReadCompleted += new OpenReadCompletedEventHandler (client_OpenReadCompleted) Ĭlient.DownloadProgressChanged += new DownloadProgressChangedEventHandler (client_DownloadProgressChanged) ![]() Private void Button_Click( object sender, RoutedEventArgs e) The content of the file downloaded is shown in the TextBlock3 that is in tern into ScrollViewer control. Once the download is complete, we should show the success message in TextBlock1. At the time of download we shall show the progress using ProgressBar control, % complete in the and amount of data left in the TextBlock2. On click of the Button, we shall write our code to download the file. In the above code snippet, we have three TextBoxes, a ProgressBar and a Button control. Get 500+ ASP.NET web development Tips & Tricks and ASP.NET Online training here. This article is the continuation of my last article in Silverlight controls series, read last article here. To demonstrate this example, we shall create a xaml file and following is my code. How to download file and displaying progress status? Silverlight also allows us connect to remote machine or services, download and upload files, all these stuffs are done using WebClient class that exists into System.Net namespace. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |