开发者

Silverlight IsolatedStorage removed when application is shutdown?

开发者 https://www.devze.com 2023-02-18 04:32 出处:网络
From what I can find, seems like the IsolatedStorage supposed to be permanent unless the user delete it manually. And the following thread says so too:

From what I can find, seems like the IsolatedStorage supposed to be permanent unless the user delete it manually. And the following thread says so too:

Is Silverlight isolated 开发者_开发百科storage treated as permanent, or as a cache?

However seems like if I shut down my application and restart it (as I am debugging on debug mode - not sure if that makes a different), the data I stored earlier is gone.

For example, just as pseudocode:

onClick =
   let storage = IsolatedStorageSettings.ApplicationSettings
   let x = storage.Item key
   storage.Add(key, "Some Value")

on first click event, "x" is null (or empty) as expected. Then on the 2nd time around, x would have "Some Value" - this all works fine as expected. However, when I stop debugging, and restart the application, first time around, "x" goes back to null or empty. Tried the same using SiteSettings.

So seems to me IsolatedStorage is not permanent afterall? Just goes with the lifetime of the application?


1- Use the SiteSettings instead of ApplicationSettings

System.IO.IsolatedStorage.IsolatedStorageSettings.SiteSettings("YourKey") = yourValue

2- You need to save the data after you change them

System.IO.IsolatedStorage.IsolatedStorageSettings.SiteSettings.Save()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号