anakic / Jot

Jot is a library for persisting and applying .NET application state.
http://www.codeproject.com/Articles/475498/Easier-NET-settings
MIT License
633 stars 56 forks source link

Save user settings #51

Closed zombiehunter1 closed 3 years ago

zombiehunter1 commented 3 years ago

Hi Is there an example of saving user settings, I've had a good hunt but can't seem to find an example

anakic commented 3 years ago

There's an example in the WPF demo app.

Jot doesn't really know anything about WPF or WinForms, it will track whichever object you tell it to.

For settings, you would usually have a class with properties that represent the settings, and you would put a [Trackable] attribute on the properties you want to track. Somewhere during your apps startup you would call tracker.Configure<YourSettingsClass>().Track(theSettingsInstance). You could persist on application shutdown or e.g. on PropertyChanged. You could make the instance of the settings object available to the rest of the application through an IOC container or via a static property.

A simple example in the readme would be in order, though... I'll see about adding that when I can get to it.