https://github.com/losttech/settings
App settings library, that supports data binding and asynchronous save. bindable app settings wrapper, which supports autosave
https://github.com/losttech/settings
Last synced: 8 months ago
JSON representation
App settings library, that supports data binding and asynchronous save. bindable app settings wrapper, which supports autosave
- Host: GitHub
- URL: https://github.com/losttech/settings
- Owner: losttech
- License: apache-2.0
- Created: 2017-03-27T01:42:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-05T18:00:09.000Z (over 3 years ago)
- Last Synced: 2025-02-23T00:44:58.905Z (12 months ago)
- Language: C#
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/LostTech.App.Settings/)
## Quickstart
1. Implement `ICopyable` from `LostTech.App.DataBinding` on your settings objects
(required to create settings snapshot which can be saved while user continues to modify settings).
2. Install [XmlSettings NuGet package](https://www.nuget.org/packages/LostTech.App.XmlSettings/) (easy serialization into XML).
3. Choose a folder to store your settings and call `XmlSettings.Create(folder)`.
4. For each settings set (e.g. a group of settings), call `cfg = await settings.LoadOrCreate(xmlFileName)`.
Handle errors here (abrupt shutdown or app crash could have corrupted the settings file).
5. Call `cfg.ScheduleSave()` to save the settings set asynchronously.
6. (optional) Set `cfg.Autosave = true` to enable asynchronous autosave.
Your settings must implement [INotifyPropertyChanged](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged)
or [INotifyCollectionChanged](https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged).
You **must** implement these interfaces for any nested objects if you have a hierarchy.
6. When the app is getting closed, call `DisposeAsync` for every set of settings.
You **MUST** wait for it to finish before your app closes.