是否可以在WP7应用程序中保存我创建的一些对象,然后在应用程序再次启动时加载它?如何在Windows Phone 7应用程序中保存和加载对象?
2
A
回答
2
你会希望将持久性项目存储到IsolatedStorage中。您可以看到如何使用IsolatedStorage here的概述和示例。 this site上还有一系列示例,显示如何保存不同类型的对象。
1
下面是存储字符串的示例,但您应该能够以这种方式存储任何类型的对象。 添加IsolatedStorage您参考:
using System.IO.IsolatedStorage;
在你的类:
private string myString;
在Loaded事件对你的页面:
try
{
myString = (string)IsolatedStorageSettings.ApplicationSettings["myString"];
}
catch
{
IsolatedStorageSettings.ApplicationSettings.Add("myString", "this value is a string");
}
后来,当你想保存:
IsolatedStorageSettings.ApplicationSettings["myString"] = myString;
0
在 之后尝试上面的示例代码来添加此项。 IsolatedStorageSettings.ApplicationSettings.save
相关问题
- 1. 保护Windows Phone 7应用程序?
- 2. Windows Phone 7应用程序
- 3. windows phone 7应用程序
- 4. Facebook应用程序和Windows Phone 7
- 5. 如何在Windows Phone 7应用程序中重新加载页面
- 6. Windows Phone 7应用程序,将csv数据加载到应用程序中
- 7. 在Windows Phone 7中保存对象列表XNA
- 8. 在Windows Mobile,Windows Phone 7和Windows Phone 8中开发应用程序
- 9. 贝宝在Windows Phone 7应用程序
- 10. 如何在Windows Phone 7中维护应用程序状态?
- 11. 如何在应用程序栏中标记menuitem Windows Phone 7
- 12. 如何在Windows Phone 7应用程序中实现收藏夹?
- 13. 在Windows 7中保存Excel加载项
- 14. Windows Phone 7应用程序在Windows Phone 8上运行吗?
- 15. 在windows phone 7应用程序中添加php web服务
- 16. 如何本地化iPhone(monotouch)和Windows Phone 7应用程序?
- 17. 保存对象IsolatedStorage中的Windows Phone 8
- 18. 在windows phone 7应用程序中完成和异步方法
- 19. 如何让我的Windows Phone 7应用程序显示在Windows Phone 8市场?
- 20. 测试Windows Phone 7应用程序
- 21. 规划Windows Phone 7应用程序
- 22. 国际化Windows Phone 7应用程序
- 23. Windows Phone 7上的Flex应用程序
- 24. Windows Phone 7应用程序问题
- 25. 为Windows Phone 7开发应用程序
- 26. Windows Phone 7隐藏应用程序栏
- 27. 应用程序栏| Windows phone 7
- 28. 部署Windows Phone 7应用程序
- 29. Windows Phone 7应用程序 - INPC问题
- 30. Windows Phone 7关闭应用程序