Reputation: 1563
My problem is that I cant find any documentation about where i should save user files, The files will contain keys and values for example. Where is the file path, Because don't windows desktop and windows phone have different folders?
FirstName="James"
Do windows universal apps have something like
LocalStorage.LocalData("MyApp\properties.prop")
or anything similar? or should i use something like "%appdata%\myapp\file.properties"
Is there any documentation somebody can link me to? or just explain what i should do?
Upvotes: 0
Views: 1211
Reputation: 1090
When choosing to save user data (p.e. settings values and other small in size data) in UWP you have 2 choices. Local and Roaming.
You can get access to these via the ApplicationData
class.
var settings = ApplicationData.Current.LocalSettings
var settings = ApplicationData.Current.RoamingSettings
and access the values like that
var myvalue = (MyClass)settings.Values["key"];
Things to bear in mind: As you will read in the documentation there are limits to how much data you can store in either container. Also if you exceed that limit for the roaming container it behaves like local storage. For larger files you can use LocalFolder and RoamingFolder but it is not as easy as simply accessing values like a dictionary.
Also in UWP there is the PublisherCacheFolder if that fits your needs.
Upvotes: 2