如何在 WP7 ViewModelLocator 中处理 TombStoning

发布于 2024-10-10 00:36:54 字数 277 浏览 0 评论 0原文

当我的 WP7 应用程序从逻辑删除状态恢复时,它会创建我存储在 App.Resources 中的 ViewModelLocator 类。你打算如何处理这个问题?在我的 ViewModelLocator 构造函数中,创建了多个 ViewModel,并且在这些构造函数中存在多个 WCF 服务调用。让此类每次从逻辑删除状态恢复时都重新创建似乎是错误的。

看来我需要在我的应用程序被逻辑删除之前序列化 ViewModelLocator,并在之后反序列化它。听起来正确吗??? MVVM-Light 中有什么东西可以处理这个问题吗?

When my WP7 app comes back from being Tombstoned, it creates the ViewModelLocator class that I have stored in App.Resources. How do are you suppose to handle this? In my ViewModelLocator constructor there are several ViewModels being created and in those constructors there are several WCF Service calls. It seems wrong to let this class be recreated every time it comes back from being tombstoned.

It seems like I need to serialize the ViewModelLocator before my app gets Tombstoned, and deserialize it after. Sound correct??? and is there something in MVVM-Light to handle this?

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

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

发布评论

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

评论(1

一江春梦 2024-10-17 00:36:54

您肯定需要保存数据才能在逻辑删除后恢复它。

MVVM Light为您提供MVVM框架,而不是WP7数据存储解决方案。您需要使用最适合您和独立存储的任何存储格式自行实现此目的。

下面是使用isolatedStorageSettings 的基本示例...WP7 SDK 提供的基于字典的抽象。

Win7 移动平台上的逻辑删除

You definitely need to save your data to be able to restore it after tombstoning.

MVVM Light provides the MVVM framework for you, not the WP7 data storage solution. You'll need to implement this yourself using whatever storage format is most suitable for you and Isolated Storage.

Here's a basic examples that uses IsolatedStorageSettings... a dictionary based abstraction provided by the WP7 SDK.

Tombstoning on the Win7 Mobile Platform

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