6.1 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:39:31.289860+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | b65049df89cf8545 |
UISettings
Documentation: UISettingsModule (DataPRO/Modules/SystemSettings/UISettings/UISettingsModule.cs)
1. Purpose
This module registers the UI settings view and view model as singleton services within the Unity dependency injection container for use in the application’s system settings UI. It serves as the Prism module entry point for the UISettings feature, enabling modular loading and dependency resolution of the UI settings component. It also provides assembly-level metadata (image and group) via the UISettingsImageAttribute, allowing the main screen to display the module as part of the Administrative group.
2. Public Interface
Class: UISettingsModule
-
public UISettingsModule(IUnityContainer unityContainer)
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration. -
public void Initialize()
Registers theIUISettingsViewinterface toUISettingsView, andIUISettingsViewModeltoUISettingsViewModel, both as singleton registrations in the Unity container. -
public void OnInitialized(IContainerProvider containerProvider)
Currently empty; no logic implemented. -
public void RegisterTypes(IContainerRegistry containerRegistry)
Delegates toInitialize(), performing the same type registrations. (Note:IContainerRegistryis a Prism abstraction, butInitialize()usesIUnityContainerdirectly — see Gotchas.)
Attribute: UISettingsImageAttribute
-
public UISettingsImageAttribute()
Default constructor; delegates to the overloaded constructor withnull. -
public UISettingsImageAttribute(string s)
Constructor accepting a string parameter (unused); initializes_imgby callingAssemblyInfo.GetImage(AssemblyNames.UISettings.ToString()). -
public override BitmapImage AssemblyImage { get; }
Returns the assembly image for UISettings, retrieved viaAssemblyInfo.GetImage(...). Uses lazy initialization (caches in_img). -
public override Type GetAttributeType()
Returnstypeof(ImageAttribute). -
public override BitmapImage GetAssemblyImage()
Returns the value ofAssemblyImage. -
public override string AssemblyName { get; }
Returns"UISettings"(fromAssemblyNames.UISettings.ToString()), cached in_name. -
public override string GetAssemblyName()
Returns the value ofAssemblyName. -
public override string AssemblyGroup { get; }
Returns"Administrative"(fromeAssemblyGroups.Administrative.ToString()), cached in_group. -
public override string GetAssemblyGroup()
Returns the value ofAssemblyGroup. -
public override eAssemblyRegion AssemblyRegion { get; }
ThrowsNotImplementedException— not implemented. -
public override eAssemblyRegion GetAssemblyRegion()
ThrowsNotImplementedException— not implemented.
3. Invariants
UISettingsModulemust be loaded as a Prism module (via[Export(typeof(IModule))]and[Module(ModuleName = "UISettings")]).IUISettingsViewandIUISettingsViewModelare registered as singleton instances in the Unity container during module initialization.AssemblyImage,AssemblyName, andAssemblyGroupare statically derived fromAssemblyNames.UISettingsandeAssemblyGroups.Administrative, and are expected to be consistent across builds.AssemblyRegionandGetAssemblyRegion()are not implemented — callers must avoid invoking them.
4. Dependencies
Imports (from source):
System,System.ComponentModel.Composition,System.Windows.Media.Imaging— WPF imaging and MEF support.DTS.CommonandDTS.Common.Interface— internal common library (containsAssemblyInfo,AssemblyNames,eAssemblyGroups,ImageAttribute,eAssemblyRegion).Prism.Ioc,Prism.Modularity— Prism framework for DI and module loading.Unity— Unity container API (IUnityContainer,IContainerRegistry).
Consumers (inferred):
- The Prism bootstrapper/module catalog — loads
UISettingsModuleat runtime. - The main UI shell — consumes
UISettingsImageAttribute(via assembly-level attribute reflection) to render module metadata (image, name, group). - Any code resolving
IUISettingsVieworIUISettingsViewModelvia Unity — e.g., views, view models, or services needing to display or interact with the UI settings UI.
5. Gotchas
-
RegisterTypesuses Prism’sIContainerRegistry, but internally callsInitialize()which uses Unity’sIUnityContainer.
This implies tight coupling to Unity and may break if the container abstraction changes or if the module is used in a non-Unity Prism setup. ThecontainerRegistryparameter is unused. -
AssemblyRegionandGetAssemblyRegion()throwNotImplementedException.
Any code expecting region metadata (e.g., for UI grouping or filtering) will crash if this attribute is used in that context. -
_img,_name, and_groupare lazily initialized and cached in private fields, but not thread-safely.
While unlikely to cause issues (assembly metadata is typically read once at startup), concurrent access during initialization could lead to race conditions. -
The
string sparameter inUISettingsImageAttribute(string s)is unused.
Likely legacy or placeholder; may mislead developers into thinking it configures something. -
No validation is performed on
AssemblyInfo.GetImage(...).
If the image resource is missing or malformed, the exception occurs at runtime (e.g.,NullReferenceExceptionor WPF imaging error), not at registration time. -
OnInitializedis empty — no post-initialization logic is defined.
If future logic is added here, it must be compatible with the current singleton registration model.
Documentation generated from DataPRO/Modules/SystemSettings/UISettings/UISettingsModule.cs.