c# - Windows Phone 上的状态大小

标签 c# windows-phone-7

我在我的应用程序中遇到了一个非常神秘的错误。我唯一的想法是我试图将太多信息保存到状态中。这篇文章的底部是错误消息。我想知道是否有一种好的方法来管理您保存到状态的数据量。我现在正在使用状态管理器来快速保存数据,但我显然需要向其中添加更多逻辑,即如果 Size > X,则保存到 Isolated 而不是 State。

这方面的最佳做法是什么?

错误:0x80040204

   at Microsoft.Phone.Shell.Interop.ShellPageManager.SetProperty(String name, Byte[] blob)
   at Microsoft.Phone.Shell.StreamPersister.Save(ShellPageManager shellPageManager, String key, IDictionary`2 dictionary, IEnumerable`1 knownTypes)
   at Microsoft.Phone.Shell.PhoneApplicationService.FireDeactivated()
   at Microsoft.Phone.Execution.NativeEmInterop.FireOnPause()

最佳答案

查看doc

You should not use this property for excessive storage because there is a limit of 2 MB for each page and 4 MB for the entire application.

首先,我会重新考虑设计。你平均节省多少钱?最大值是多少?让用户长时间等待加载是糟糕的用户体验。如果您真的需要这个,请考虑仅使用 IsolatedStorageFile 而不要使用“如果 Size > X,则保存到 Isolated 而不是 State。”

关于c# - Windows Phone 上的状态大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9998090/

相关文章:

c# - 我将如何在密码框顶部覆盖灰色单词 'password'?

silverlight - 在运行时添加 ResourceDictonary 时出现异常

windows-phone-7 - 查找多边形坐标WP7

c# - 我将如何创建 Windows Phone Live Camera Feed?

c# - 单实例形式但不是单例

c# - 将 C++ dll 导入 Windows Phone 项目

c# - 管理多个线程的存储池

c# - 如何使用 C# 在 Selenium WebDriver 中按下 'Esc' 键

c# - 静态代码块

c# - 不知道如何使用 ms-appx (wp8) 引用我项目中的文件