相当于 Windows Phone 7 中的 onResume()
我正在向 wp7 专家寻求一些应用程序生命周期帮助。我的应用程序在特定页面中有刷新步骤,但我只想在用户从后台启动应用程序时启动此步骤。
注意-仅当我导航(返回)或用户接听电话然后重新打开应用程序(保持同一页面打开)
提前谢谢您
I'm looking for some app life cycle help from the wp7 experts. My app has a refresh step in a specific page but I only want to launch this when the user brings the app to life from the background.
Note- The life cycle step I'm looking for isn't called when the page is init() only when I'm navigated (back) to or the user has taken a phone call and then re-opens the app (keeping the same page open)
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找的称为墓碑化,您可以在 http://wildermuth 找到一篇很棒的文章.com/2010/10/17/Architecting_WP7_-_Part_5_of_10_Tombstoneing
这些事件是:
您正在寻找激活事件。这些位于您的 App.xaml.cs/vb 文件中。挂钩事件并更新您的数据模型。当您的页面绑定到该模型时,它将获取数据。
如果您没有使用 MVVM,并且无法真正从该事件刷新,则可以使用
PhoneApplicationService.Current.StartupMode
属性来执行此操作。它有两个选项激活
(您正在寻找的内容)和启动
(从磁贴中新鲜加载)。它看起来像what you are looking for is called Tombstoning and you can find a great article at http://wildermuth.com/2010/10/17/Architecting_WP7_-_Part_5_of_10_Tombstoning
The events are:
You are looking for the Activated event. These are in your App.xaml.cs/vb file. Hook into the event, and update your data model. When your page is bound to that model it will get the data.
If you are not using MVVM, and can't really refresh from that event, you can do it using the
PhoneApplicationService.Current.StartupMode
property. It has two optionsActivate
(what you are looking for) andLaunch
(loaded fresh from the tile). It would look something like