简体   繁体   中英

What is the best way to store user notes locally for a UWP notes app?

I'm working on a simple light-weight notes app that will allow a user to simply store quick notes, and maybe even tag notes. I would like to actually know what is the best way to LOCALLY store these notes. Also, at some point I may also allow for the user to do a few more advanced things, like style the text, so the way I store the data needs to be flexible enough to deal with this, too.

At a later time I will implement a way for the user to save this data in the cloud (OneDrive), but that's not the big matter here. Thanks!

Is it me, or Microsoft doesn't provide any OFFICIAL documentation that lists and details storage options for UWP apps? It would have been nice to see a list of these options so that we could then take it upon ourselves to do some detailed research on them and make a decision for what we should use based on that. Seems like you have to dig deep into the web to ascertain what's available and MOST compatible with their latest operating system.

You can refer to Create, write, and read a file .

Actually, there are official documents for UWP development, you can refer to How-to guides for Windows 10 apps .

This Files, folders, and libraries chapter details storage file, folder of UWP.

More even, there a lots of Universal Windows app samples on GitHub, there are several samples here about storage.

Noticed that you want to store the notes after style them, you will need to serialize them to string format before storing, and deserialize them after you read them from file.

The XmlSerializer Class can help you with serializing and deserializing, you can also refer to the official Serializing and deserializing data sample .

And there is no "best way", it's all up to your need.

The best method would be using Sqlite create a database write the notes in this database with timestamp, username etc. and store this database in local storage.
If you just need to simply save what user had written you can write to a text file in local storage.if you dont want to write simple code. Though finding required notes later would be difficult

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM