如何应立碑地铁应用程序缓存图像(也应该是)? [英] how should a metro app cache images for tombstoning (and should it)?

查看:173
本文介绍了如何应立碑地铁应用程序缓存图像(也应该是)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#地铁的应用程序,下载该有一个URI属性对象的集合。
该集合绑定到约束,这工作正常图像源的列表框。

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.

保存收藏是容易的,钩住在图像ImageLoaded事件是容易的,但我怎么能然后保存该图像?

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

这是必需的功能,将窗户自动缓存这种类型的HTTP的基于图像?

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

当心,这个API已经改变了RP和使用WritableBitmap了常见的例子不再作为构造不再能接受的ImageSource工作。

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.

更新:

APP新城 - 的BitmapImage为byte []或从网络下载图像,并将其转换为一个byte []数组
这就是我很害怕,那些不使用现有的工作势必图像元素,但让一个单独的HTTP调用。我真的不想下载我的所有图像的两倍。
我会尝试秒杀,看看Windows缓存此方案中的http请求。

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.

推荐答案

这答案呼应以前的答案被删除。

This answer echoes the previous answer that was removed.

要提供上述要求的用户体验的唯一方法是在本地手动缓存图像。在这个领域没有任何针对程序员完成的。

The only way to provide the required user experience described above is to manually cache the images locally. Nothing in this realm is done for the programmer.

什么是没有出现在编码解决方案,一个新的问题已经建立,以解决这个问题。 如何我可以从保存的图像没有的ImageSource再次下载?

What was not presented was the coded solution, a new question has been created to address this. How can I save an image from an ImageSource without downloading again?

这篇关于如何应立碑地铁应用程序缓存图像(也应该是)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆