The correct thing to do is [to not follow the example in the
Silverlight docs, but instead] either use:

web = WebClient()
web.DownloadStringCompleted += completed
web.DownloadStringAsync(uri)

*or*

web = WebClient()
web.OpenReadCompleted += completed
web.OpenReadAsync(uri)

Depending on whether you want to fetch a server resource as a string
or as a stream. :-)

Michael
http://www.manning.com/foord

On Mar 11, 11:17 pm, Michael Foord <[EMAIL PROTECTED]> wrote:
> Hello guys,
>
> With the following code executed in Silverlight2 I find I get the
> 'DownloadProgressChanged' event fired 3 times and the
> 'OpenReadCompleted' not at all. :-(
>
> The changed event shows 100% completed every time it is fired...
>
> from System import Uri, UriKind
> from System.Net import WebClient
>
> uri = Uri('/', UriKind.Relative)
> web = WebClient()
>
> def completed(s, e):
>     print 'Completed'
>     print e.Error
>     print e.Cancelled
>     print e.Result
>
> def changed(s, e):
>     print 'Bytes Recieved', e.BytesReceived
>     print 'Progress Percentage', e.ProgressPercentage
>
> web.OpenReadCompleted += completed
> web.DownloadProgressChanged += changed
> web.DownloadStringAsync(uri)
>
> Anyone got any clues?
>
> Thanks
>
> Michaelhttp://www.manning.com/foord
> _______________________________________________
> Users mailing list
> [EMAIL PROTECTED]://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to