Windows Phone 7 保持应用程序在后退按钮上运行

发布于 2024-11-08 16:24:19 字数 71 浏览 0 评论 0原文

我正在实现一个应用程序,该应用程序不应在单击设备上的任何按钮时停止运行。这可能吗?我怎样才能实现这一目标?

问候

I'm implementing an application that should not stop running on clicking any button on the device. Is this possible and how can I achieve this?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清晨说晚安 2024-11-15 16:24:19

Windows Phone 7 不支持多任务处理(在后台运行应用程序)。从文档中了解有关应用程序生命周期的更多信息。 Mango下一个版本的Windows Phone 7将支持在后台运行一些代码。

目前,您能做的最好的事情就是在应用程序退出或发送到后台时保存应用程序状态。对于简单的设置(键值对),您可以使用 IsolatedStorageSettings;对于更复杂的内容,您可以使用 IsolatedStorage 文件系统。

这是一篇关于应用程序生命周期和状态保存的非常好的文章。
此处概述了 <代码>隔离存储。

Windows Phone 7 does not support multitasking (running applications in the background). Read more about application lifecycle from documentation. Mango the next version of Windows Phone 7 will support running some code in the background.

Currently the best you can do is save the application state when the app is quit or sent to the background. For simple settings (key-value pairs) you can use IsolatedStorageSettings and for more complicated stuff you'd use IsolatedStorage file system.

This is a really great article about application life cycle and state saving.
And here is an overview of IsolatedStorage.

北方的韩爷 2024-11-15 16:24:19

您的应用程序将被逻辑删除。您需要对此进行一些研究。

社区中的人们已经构建了许多可以提供帮助的选项。这完全取决于您想做什么。如果您的模型很复杂,您肯定会序列化到独立存储(但是有一些项目可以做到这一点。

一个非常简单的使用方法是:http://tombstonehelper.codeplex.com/

Your app will be tombstoned. You will need to do a little research on that.

There are a number of options that folks in the community have built that can help. It all depends on what you want to do. If your model is complex you will most definitely be serializing to Isolated Storage (but there are some projects out there that can do this.

A pretty simple one to use is this one: http://tombstonehelper.codeplex.com/

秋心╮凉 2024-11-15 16:24:19

预计下周(2011-05-24)将发布一整套更新,后台任务预计将成为受影响的内容之一。

使用公开可用的工具,您可以拥有的最好的就是“在锁定下运行”,您可以通过以下方式实现这些说明

请注意,这种行为能够通过合规性测试的情况受到严格限制,因为您会严重损坏电池。

您关于独立存储的问题是一个很好的问题。这是保存状态的仅有的两种方法之一。另一种是使用 Web 服务在服务器上存储状态(云计算)。

要直接回答您的一个问题,不,不可能创建一个不能被任何按钮中断的进程。这都是关于资源管理和维护用户体验。 WP7 应用程序的架构完全是 UI 驱动的。只有一个用户进程在运行,用户可以随时通过调用另一个应用程序来抢占这一进程。这使得编写日志服务几乎不可能,但即将到来的更新可能会改变游戏规则。

There is a whole set of updates expected to drop next week (2011-05-24) and background tasks are posited to be one of the things affected.

With publicly available tools the best you can have is "runs under lock" which you achieve by following these instructions.

Be aware that there are strictly limited scenarios under which this behaviour will pass compliance testing, because you will severely hammer the battery.

Your question about isolated storage is a good one. This is one of only two ways to preserve state. The other is to use a web service to store state on a server (cloud computing).

To directly answer one of your questions, no, it is not possible to create a process that cannot be interrupted by any of the buttons. This is all about resource management and preserving the user experience. The architecture of a WP7 app is entirely UI driven. Only one user process is ever running and the user may pre-empt this at any time by invoking another application. This makes it almost impossible to write logging services, but imminent updates may change the game.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文