Introduction
I have been living with different settings managers of .NET and other frameworks for a while and have realized that they all have their merits but somehow all have something important missing for me. The .NET settings model seems to be OK in the sense that it is easy to use but often produces problems with advanced data. Other setting frameworks also seem to do the trick but they all miss advanced features, such as:
- Clear and simple integration into frameworks like PRISM or Caliburn and
- Run-time configuration in dependence of the actual modules loaded.
So I have decided to roll my own SettingsModel
and integrated it into a WPF demo application to show off its capabilities:
https://settingsmodel.codeplex.com/
If there is anything interesting, then the demo project might represent an interesting project template for a Modern UI style application (https://github.com/firstfloorsoftware/mui) since it does not only contain these styles, but is also able to store and retrieve changed settings.
So, this full functioning Modern UI template contains the complete required code spanning from model, viewmodel, to view (while the normal MUI template contains only view and viewmodel parts).
The template contains fully functioning core features every application should contain these days:
- Reload files on application re-start
- Setting for font size
- Settings for light or black application skin and accent color
- Folder bookmarks
- Settings for icon size
- An about page with information on the loaded modules
Background
This project makes use of the DataSet
and DataTable
classes to read and write arbitrary .NET values and types in XML. This means that you are no longer concentrating on the actual file format of the XML but rather on the content and involved workflows of the data that you are ending up to store and retrieve.
The model can be accessed via an API that is similar to a query API of a database interface since every stored value can be identified by its path. This means that parts of the settings can (have to) be registered at run-time to reflect the current configuration settings of the application. This framework, makes it therefore, simple to produce a viewer and a Power-User-Advanced application of a product in which parts of different product flavours share similar settings.
Using the Code
The code usage is demonstrated at the referenced Codeplex site at:
The documentation at the site contains more detailed descriptions, a software design model, more screenshots, and demo applications. Please let me know what you think about it and whether you find something is missing...