--- source_files: - DataPRO/Modules/SystemSettings/PowerAndBattery/View/PowerAndBatteryView.xaml.cs generated_at: "2026-04-17T16:15:47.040696+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "b29c532f19d777c9" --- # View ### 1. Purpose This module provides the ViewModel component for the Power and Battery settings UI within the SystemSettings feature area. It follows the MVVM pattern using Prism and MEF, serving as a placeholder view model that integrates with the application's navigation, event aggregation, and dependency injection infrastructure. The module currently provides minimal domain-specific functionality but establishes the structural foundation for power and battery configuration management. ### 2. Public Interface **Class: `PowerAndBatteryViewModel`** - Inherits: `BasePropertyChanged` - Implements: `IPowerAndBatteryViewModel` - MEF Export: `[Export(typeof(IPowerAndBatteryView))]` with `[PartCreationPolicy(CreationPolicy.Shared)]` (singleton scope) **Constructor:** ```csharp public PowerAndBatteryViewModel(IPowerAndBatteryView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer) ``` Initializes the view model, sets the View's DataContext to itself, creates interaction requests, and subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events. **Lifecycle Methods:** - `void Cleanup()` - Empty implementation - `Task CleanupAsync()` - Returns `Task.CompletedTask` - `void Initialize()` - Empty implementation - `void Initialize(object parameter)` - Empty implementation - `void Initialize(object parameter, object model)` - Empty implementation - `Task InitializeAsync()` - Returns `Task.CompletedTask` - `Task InitializeAsync(object parameter)` - Returns `Task.CompletedTask` - `void Activated()` - Empty implementation **Properties:** - `IPowerAndBatteryView View { get; }` - The associated view instance - `InteractionRequest NotificationRequest { get; }` - For raising notification dialogs - `InteractionRequest ConfirmationRequest { get; }` - For raising confirmation dialogs - `bool IsDirty { get; private set; }` - Tracks unsaved changes state - `bool IsBusy { get; set; }` - Busy indicator state, bound to UI - `bool IsMenuIncluded { get; set; }` - Menu inclusion flag - `bool IsNavigationIncluded { get; set; }` - Navigation inclusion flag - `string HeaderInfo { get; }` - Returns hardcoded "MainRegion" **Private Event Handlers:** - `void OnBusyIndicatorNotification(bool eventArg)` - Sets `IsBusy` property from event - `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` - Raises notification dialog via `NotificationRequest.Raise()` ### 3. Invariants - The `View` property is set at construction and never reassigned. - `View.DataContext` is always set to `this` (the ViewModel instance) during construction. - `NotificationRequest` and `ConfirmationRequest` are initialized at construction and never null. - Event subscriptions use `ThreadOption.PublisherThread` for `BusyIndicatorChangeNotification` with `keepSubscriberReferenceAlive: true`. - `HeaderInfo` always returns the literal string "MainRegion". ### 4. Dependencies **Imports (this module depends on):** - `DTS.Common.Base` - `BasePropertyChanged` base class - `DTS.Common.Events` - `RaiseNotification`, `BusyIndicatorChangeNotification`, `NotificationContentEventArgs` - `DTS.Common.Interactivity` - `InteractionRequest`, `Notification`, `Confirmation` - `DTS.Common.Interface` - `IPowerAndBatteryView`, `IPowerAndBatteryViewModel` - `Prism.Events` - `IEventAggregator`, `ThreadOption` - `Prism.Regions` - `IRegionManager` - `Unity` - `IUnityContainer` - `System.ComponentModel.Composition` - MEF attributes **Dependents (inferred):** - The View component (`PowerAndBatteryView`) which is injected via constructor - Shell/Bootstrapper that discovers and loads this MEF export ### 5. Gotchas - **Stale XML documentation**: The constructor's XML comment references "TechnologyDomainEditViewModel" which appears to be a copy-paste error from another module. - **Empty lifecycle methods**: All `Initialize` and `Cleanup` methods are empty shells. The module does not perform any initialization or cleanup logic. - **Unused `ConfirmationRequest`**: While instantiated, `ConfirmationRequest` is never raised anywhere in this class. - **Hardcoded `HeaderInfo`**: Returns "MainRegion" which may be misleading as it suggests region identification but is a static string. ---