QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
52 lines
2.5 KiB
Markdown
52 lines
2.5 KiB
Markdown
# 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<span>.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
|
|
``` |