WP7 - 从我分配的页面恢复 [英] WP7 - Resume from the page I assigned

查看:19
本文介绍了WP7 - 从我分配的页面恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有两个页面 MainPage 和 DetailsPage.在详细信息页面中,用户点击开始按钮,然后点击后退按钮进入上一页.如果我们没有墓碑编码,他们将有空白页.

Lets assume I have two pages MainPage and DetailsPage. In details page user hits on start button then hits on the back button to get to the Previous Page. And If we don't have tombstone coding they will have blank page.

当他们点击返回按钮时,是否可以从 MainPage(而不是详细信息页面)恢复应用程序.

Is it possible to resume the application from the MainPage (not the detailspage) when they hit back button.

亲切的问候.

推荐答案

我不确定这是否可以通过内置代码路径实现,但是您可以使用 检测手机何时从墓碑激活PhoneApplicationService.Activated 事件.发生这种情况时,您可以直接或通过编程后退按钮手动将手机导航到您的主页.

I'm not sure if this is possible via a built-in code path, but you can detect when the phone is activating from tombstone using the PhoneApplicationService.Activated event. When this occurs, you could manually navigate the phone to your main page either directly or via programmatic back button presses.

不过,我会反对所有这些.您的应用程序应该将数据序列化到独立存储并正确恢复.在我看来,这是用户希望在 WP7 应用程序中看到的预期行为.

I would argue against all of that though. Your app should serialize the data to isolated storage and restore it properly. This is the expected behaviour users will want to see inside WP7 apps in my opinion.

http://www.imaginativeuniversal.com/blog/post/2010/08/22/WP7-Tombstoning-Pattern-Tip.aspx

更新:来自克劳斯在下面的评论中.您还可以利用 URL 上的查询字符串.当应用程序被墓碑化时,这会自动持久化.此查询字符串可用于再次触发数据加载,从而避免序列化整个集合.在您的情况下,您似乎是从 Web 获取数据,因此查询字符串对您很有效.

Update: from Claus in the comments below. You can also utilise the query string on the URL. This is automatically persisted when the app is tombstoned. This query string can be used to trigger the loading of data again, to save you from serializing the entire set. In your case it looks as though you are fetching data from the web, so the query string will work well for you.

但是,您需要权衡这与给用户的电话数据计划增加压力.如果序列化集合是一​​个廉价的操作,我会说走那条路.

However, you need to weigh that against adding pressure to the user's phone data plan. If serializing the set is a cheap action, I'd say go that route.

这篇关于WP7 - 从我分配的页面恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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