question

level6 avatar image
0 Votes"
level6 asked yanxiaodi commented

[UWP] Serialize app local settings

I want to be able to take the settings for my app and copy them so that they can be shared by different users on different machines. Is there a way to serialize or some how copy the app settings to a different location?

windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered

Hello,​

Welcome to our Microsoft Q&A platform!

Generally speaking, the local settings of UWP apps like fonts, colors, could be saved in LocalSettings. And if the customer wants to share the setting data between different devices, RoamingSettings could help. I'm not sure where you save the setting data in your app. Do you save it in a local file or in some other ways?

Also, I'm a little confused about why you want to enable sharing setting data between users?
It might be better to have a server that could save the setting data if you want to share the setting data between different users. You could upload the setting data to the server and download it according to different requirements.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

level6 avatar image
0 Votes"
level6 answered yanxiaodi commented

My reason for wanting to share settings between individuals is because my app, yMidi Toolbox Plus, allow the user to setup custom MIDI controller setups for controlling musical instruments and music software. Being able to share these configurations between user would be a nice feature.

My app saves to LocalSettings. Ideally I would like to write the settings to an XML or JSON file, something that could be visually inspected and changed if needed.

So far it's looking like I will probably need to roll my own solution.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I understand the requirement now. If you mean share data with different users in the same device, maybe you could try to save the setting data in an XML or JSON file in D disk. But I'm not sure if it is acceptable to you. If you don't like this, maybe you need to find some other places to store the data online and access them when you need it.

0 Votes 0 ·

So, back to my original question. Is there any API for serializing app settings to JSON or XML, or do I need to create my own?

0 Votes 0 ·

I think you could serialise your setting object as a json file. You could easily use json.net to serialise it then upload it to your server or somewhere.

0 Votes 0 ·