Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an XNA Game use IsolatedStorageSettings for WP7?

I've been trying to port some Windows Phone 7 code between Silverlight to XNA which relies on IsolatedStorageSettings but I can't get Visual Studio to resolve it. When I have a look at what Intellisense is resolving under System.IO.IsolatedStorage & it lists IsolatedStorageFile, IsolatedStorageException & IsolatedStorageStream.

The documentation says that the supported version is for Silverlight but I don't understand why I am seeing the difference because of the project types.

http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.IO.ISOLATEDSTORAGE.ISOLATEDSTORAGESETTINGS);k(ISOLATEDSTORAGESETTINGS);k(TargetFrameworkMoniker-%22SILVERLIGHT,VERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true

Thanks

like image 639
Sebastian Gray Avatar asked Oct 13 '22 22:10

Sebastian Gray


1 Answers

The following work for me in an XNA project with no extra project references:

using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
    store.CreateFile("folder/file.ext");
}

After adding a reference to System.Windows.dll I can then do:

var settings = IsolatedStorageSettings.ApplicationSettings;
settings.Add("something", "myValue");
settings.Save();

If you can't get the above working, can you post an example of what you're trying.

like image 67
Matt Lacey Avatar answered Oct 18 '22 03:10

Matt Lacey