开发者

Show progress indicator while downloading Prism modules ondemand

开发者 https://www.devze.com 2023-01-14 15:08 出处:网络
I have a Silverlight 4 app using Prism 2.2 and I have a few modules that I am loading on demand by defining them as ondemand in the module catalog (via a xaml file) and then using the ModuleManager to

I have a Silverlight 4 app using Prism 2.2 and I have a few modules that I am loading on demand by defining them as ondemand in the module catalog (via a xaml file) and then using the ModuleManager to request the module be downloaded

Is there a mechanism in Prism to determine when the module download is completed and get to download progress events?

There was a thread on the prism codeplex site but none of the suggestions seemed to pan out 开发者_JS百科for the folks having the discussion

http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=47957

thanks Michael


It turns out that the solution provided in the prism discussion on codeplex worked like a charm

http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=47957

I created a custom FileDownloader called FileDownloaderWithProgress.

I wanted to subclass the existing one in Prism but the WebClient that fires the DownloadProgressChanged event was private. So I had to create my own by implementing IFileDownloader.

In the DownloadProgressChanged event handler in the FileDownloaderWithProgress class- I publish a Prism event that includes the % complete and the module name that was downloaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消