Click here to Skip to main content
15,741,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem in my WP7 project. In my project,i use XML file and store it in Isolated Storage. when i close my application and restart it, data is still available but when i turn off Emulator and re-open my application, my all data isn't available any more.
Posted
Updated 6-Mar-12 22:18pm
v2
Comments
OriginalGriff 7-Mar-12 3:05am    
I'm sure English is not your native language, but it is the default language for this site.
In English, your question makes no sense at all.
Please, either try to find a better translation of your question to English, or find a site in your own native language, as they may be able to help you better than we can!
Use the "Improve question" widget to edit your question and provide better information.
Sergey Alexandrovich Kryukov 7-Mar-12 3:07am    
I think this is more or less clear; I answered...
--SA
khachla3 7-Mar-12 4:19am    
thanks, i had improved my question.
OriginalGriff 7-Mar-12 4:32am    
Much better! And it looks like Pete has already answered you...:laugh:

The issue here is that you are running your code inside the Windows Phone emulator. When you close the emulator, all data that has been "saved" into isolated storage disappears as it is not a real device.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Mar-12 19:16pm    
Good point, my 5.
--SA
khachla3 7-Mar-12 21:01pm    
the data is stored into isolated storage on real device, is data still available in memory when i shutdown device? because i don't have device to practice.
Pete O'Hanlon 8-Mar-12 2:16am    
When the device is shut down, there is no memory. It's switched off after all. But yes, if you have persisted your data into IsolatedStorage, it will be available when the device is powered up again.
These issues are not related to isolated storage. In this respect, isolation storage works exactly the same way as a "regular" file or a file stream: if you remove power from a computer suddenly, and the file is not closed, the result is unpredictable. To commit stream changes to the file system, the method Flush is usually used.

This is because if stream bufferization used to improve performance. Most stream write operations go to the buffer and not committed to the hard drive immediately. The method Flush synchronized the buffers with the data on a drive.

Please see:
http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefilestream.aspx[^],
http://msdn.microsoft.com/en-us/library/48cytchs.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Pete O'Hanlon 7-Mar-12 4:28am    
Actually, in this case, the reason it fails to "resurrect" the data is because it's running inside the Windows Phone emulator. This is not a real device, so isolated storage is emulated as well.
Sergey Alexandrovich Kryukov 7-Mar-12 19:15pm    
Oh, good point. Thank you for the note. There is no a hard drive, which is a different story.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900