0

I have a c# metro app that downloads a collection of objects that have a property for a uri. This collection is bound to a ListBox with an Image source bound, this works fine.

When the app is tombstoning, I want to preserve all app state including the collection and the images that have been downloaded from the internet.

Covering the case, the users actions result in the collection being downloaded and displaying correctly they switch away to another app and the my app is terminated. The user then switches back to my app and expects exactly the same display as before but are now not connected to the internet.

Saving the collection is easy, and hooking into the ImageLoaded event on the Image is easy but how can I then save that image?

Is this required functionality, will windows automatically cache this type of http based image ?

Beware, the API has changed for RP and the commonly found examples using WritableBitmap no longer work as the constructor can no longer accept an ImageSource.

Update:

Metro APP - BitmapImage to Byte[] or Download Image from Web and convert it to a Byte[] Array that's what I was afraid of, those do not use the existing working bound image element but make a separate http call. I really do not want to download all my images twice. I will try a spike and see if windows caches the http request in this scenario.

4

1 回答 1

0

此答案与已删除的先前答案相呼应。

提供上述所需用户体验的唯一方法是在本地手动缓存图像。在这个领域没有为程序员做任何事情。

没有提出的是编码解决方案,已经创建了一个新问题来解决这个问题。如何从 ImageSource 保存图像而无需再次下载?

于 2012-06-20T08:14:00.187 回答