A common requirement of extensions is to have a small amount of configuration data to customize the extension to the current situation. To enable this, Loupe manages multiple scopes of configuration on behalf of each Extension.
Beyond general configuration data Loupe also supports secure credential storage in three separate scopes:
It's recommend you utilize these facilities to store credentials since it ensures they will be encrypted using strong, hybrid key encryption whenever they are written to storage or transported to another computer. The encryption is designed so that it can only be decoded within the scope it's sent to, so the files can't be copied to another computer and accessed.
You can access all of the configuration from the Configuration Property of the IRepositoryContext Interface which is provided to every part of your Extension. The information is internally cached to improve performance, and will not change except immediately before the ConfigurationChanged method of each Extension is called.
To provide a great user experience for managing configuration you should create a Configuration Editor. This is a dialog that will be invoked automatically when the user requests it from the Extension manager or when your code calls the EditConfiguration method on the IRepositoryContext Interface. When invoked, the configuration editor will be provided with a copy of the current configuration. If the EditConfiguration method returns DialogResult.OK then the configuration will be persisted and the extension will be notified the configuration has been updated.
Before your extension is enabled the first time your configuration editor (if specified) will be invoked. The extension will only be enabled if the configuration editor returns DialogResult.OK.
The User, Common and Server configuration is automatically replicated between computers using Loupe. This allows you to configure your extension on the server from any Desktop subscribed to the server. Loupe will automatically retrieve the latest configuration and then update it back to the server when the user completes the configuration dialog. When each copy of Desktop starts it checks in with the Server for updated configuration files.
Since Loupe Desktop may not be connected to its server (due to networking issues or other problems) when the configuration editor is invoked you can check if the server is available during the configuration process to determine if you want to allow them to edit server-related configuration. Use the IsServerAvailable properties of the IRepositoryContext Interface to check this at runtime.