The approach shown below is only compatible with version 2.0 of the Vault Application Framework, where the target audience runs M-Files 2018 or higher. If using version 1.0, or to maintain compatibility with M-Files 2015.3 and lower, configuration attributes should be used instead.
M-Files 2018 introduces a new section within the M-Files Admin software that collates a variety of customisable configuration options from across the M-Files vault, including:
Ensure that your vault application implements MFiles.VAF.AdminConfigurations.IUsesAdminConfigurations. This will require you to declare one method - InitializeAdminConfigurations - as shown below.
Registering configuration nodes
The InitializeAdminConfigurations method allows a developer to add configuration nodes into the M-Files Admin configuration screen, and for these configuration nodes to be rendered within the M-Files Admin.
In the sample below we declare a custom configuration class named Configuration, which must be marked with the [DataContract] attribute from System.Runtime.Serialization. All fields and properties of this class that are marked with the [DataMember] attribute will be shown within the M-Files Admin interface, as shown in the screenshot below.
Configuration values can be more than just strings. More information on editor types is available on the dedicated page. Configuration values can even be hierarchical.
Reacting when configuration changes
The configuration can be automatically updated when changes are saved within the M-Files 2018 Admin interface
The ConfigurationNode<T> returned from the call to AddSimpleConfigurationNode will raise a Changed event when the configuration within the M-Files Admin is altered. This allows your application to reflect an updated configuration without requiring a vault restart: