WP7 + IsoStore +失去价值 [英] WP7 + IsoStore + loosing value
问题描述
大家好......我在使用IsolatedStorageSettings.ApplicationSettings时遇到了一个奇怪的行为......
当我将数据保存到商店并离开时我的应用程序中的当前页面我可以正常从IsoStore重新加载数据...
当我点击 ""或"搜索"按钮,然后点击"后退"按钮按钮重新加载应用程序,存储的数据不再可用...
我正在使用Imports System.Io。 IsolatedStorage指令位于页面顶部,代码如下:
保存
Dim appSettings As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings
如果appSettings.Contains(" SavedGame")则为
appSettings(" SavedGame")= currentGame
否则为
appSettings.Add(" SavedGame",currentGame)
结束如果
后退
Dim appSettings As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings
如果appSettings.Contains(" SavedGame")则为
返回CType(appSettings(" SavedGame"),SavedGame)
否则为
什么都不返回
结束如果
PS:我正在使用模拟器对此进行测试...所以我的问题是......有什么这段代码错了,或者只是模拟器的行为?
谢谢,
问候,
Victor
这是Windows Phone 7相关问题的错误论坛。
我建议您可以在MSDN App Hub论坛中发布您的问题:
http://forums.create.msdn.com/forums / 。
Hi everybody... I'm facing a strange behavior when using the IsolatedStorageSettings.ApplicationSettings...
When I save my data to the store and navigate away from the current page in my app I can reload the data from IsoStore normally...
When I hit the "start" or "search" buttons and then hit the "back" button to reload the application, the data stored is no longer available...
I'm using the Imports System.Io.IsolatedStorage directive on top of page and the code bellow:
Saving
Dim appSettings As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings
If appSettings.Contains("SavedGame") Then
appSettings("SavedGame") = currentGame
Else
appSettings.Add("SavedGame", currentGame)
End If
Retreiving
Dim appSettings As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings
If appSettings.Contains("SavedGame") Then
Return CType(appSettings("SavedGame"), SavedGame)
Else
Return Nothing
End If
PS: I'm using the emulator to test this... so my question is... is there anything wrong in this code or it's just the emulator behavior?
Thanks,
Regards,
Victor
This is the wrong forum for Windows Phone 7 related questions.
I'd suggest you post your question in the MSDN App Hub forums here: http://forums.create.msdn.com/forums/.
这篇关于WP7 + IsoStore +失去价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!