Reputation: 283
I'm porting my game "Bustin' Jieber" on Windows Phone to Windows 8, and I have to do a isolated storage-like system to hold the settings, records and the money. I'm using this on windows phone:
IsolatedStorageSettings iosystem = IsolatedStorageSetting.ApplicationSettings;
and for example the money system;
iosystem["bjc"] = (int.Parse(iosystem["bjc"].ToString()) + (points * int.Parse(iosystem["pointduplication"].ToString())));
How can I implement this into my code? Please give me a usable code (with namespaces or so) ! Thanks! also, app is c#...
Upvotes: 0
Views: 452
Reputation: 283
By said by kumar, you can use ApplicationData stuff, but let me show you an easier version based on kumar's answer:
Windows.Foundation.Collections.IPropertySet setting = Windows.Storage.ApplicationData.Current.LocalSettings.Values;
and just replace localsettings.Values (on kumar's answer) to setting. Good luck people :)
Upvotes: 0
Reputation: 864
You can use ApplicationData.Current.LocalSettings;
Sample Code:
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
// Create a simple setting
localSettings.Values["exampleSetting"] = "Hello Windows";
// Read data from a simple setting
Object value = localSettings.Values["exampleSetting"];
if (value == null)
{
// No data
}
else
{
// Access data in value
}
// Delete a simple setting
localSettings.Values.Remove("exampleSetting");
& here is relevant post from MSDN
Apart from this you can try this from CodePlex [I didn't tried this before]
Upvotes: 2