# How to create a settings page Naming convention for your settingspage is simple: [YourSettingsName]Settings[Controller/View/ViewModel] ## Create your Controller First you have to create a class that implements `ICentronAppModuleSettingController`. `CreateSettingControlInstance()` needs to handle the creation of the view and the viewmodel and **set the DataContext for the view**. This should all be done in this method and not in the ctor of the view. **You MUST also add an ImageLarge.** ## Create your View Next create a view of the type `BaseSettingControl`. You have to implement `DoInitalize()` and simply route it through to your viewmodel. It should handle all the loading of settings. Then implement `DoSave()` and again simply route it to your viewmodel. If you want to restrict saving you can also implement `CanSave()`. `DoAfterSave()` allows you to execute something after saving of all pages is complete. The view should not implement a WaitIndicator. One will be shown on initialization and on saving by the container. ## Create your ViewModel The viewmodel does not need to implement anything specific aside from `BindableBase`. It should handle initialization and loading of settings in a asnyc method called from the view. Nothing should be loaded via the ctor. Saving should be done with another async method that is called from the view. If there is an error during loading or saving you need to throw an exception. The container will handle it and show a error dialog. **Do NOT display a messagebox yourself**. Of course all other c-entron.NET conventions apply ;) ## Register your Controller If your settings applies to a specific module it needs to be registered in that modules `ICentronAppModuleController.GetSettings()`. If it does not belong to a specific module it needs to be registered in `ModuleRegistration.GetSettingsWithoutModule()`. If your settings page is a personal settings it needs to be registered in `ModuleRegistration.GetPersonalSettings()`. **If the specific module is not registered in the moduleslist you need to register your settings in both `ICentronAppModuleController.GetSettings()` in your module and `ModuleRegistration.GetSettingsWithoutModule()`.** ## Examples ``` Centron.WPF.UI/Modules/Administration/CentronConfigDb/CentronConfigDbSettingsController.cs Centron.WPF.UI/Modules/Helpdesk/Settings/TypesHelpdeskTypeSettingsControllers.cs Centron.WPF.UI/Modules/MyCentron/PersonalSettings/UI/PersonalUISettingsController.cs ```