How to know when isolated storage is being deleted in Silverlight?
I have a Silverlight app that uses IsolatedStorage to store some info about the current session.
If the user right clicks the mouse and chooses Silverlight and goes to delete the application storage, I get an 开发者_如何学编程exception of type IsolatedStorageException when I call IsolatedStorageFile.GetUserStoreForSite().
I don't want to use try-catch block to catch the exception, I just want to be able to call the method successfully, or a similar method like the one above.
Is there a way to know (maybe an event) when user deletes the application storage? I use Silverlight 4.0.
Thank you very much !
They are no events that you can use to determine whether the user has done that action.
The best you can do is use an error handler and display a message to the user, perhaps politely pointing out that one possible cause might be the deletion of a site storage.
According to the documentation unless the user has disabled or set set the quota to 0 the call should succeed but I wouldn't be surprise if SL doesn't like it.
精彩评论