7.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:42:47.252875+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 2371d547d8ea5652 |
ViewModel
Documentation: RealtimeSettingsViewModel
1. Purpose
The RealtimeSettingsViewModel class serves as the view model for the Realtime Settings UI module within the application. It implements the IRealtimeSettingsViewModel interface and is exported as an IRealtimeSettingsView using MEF, enabling Prism-based MVVM integration. Its primary responsibilities include managing UI state for real-time configuration settings (e.g., sample rate, delay), handling interaction requests for notifications and confirmations, and responding to global events—specifically RaiseNotification and BusyIndicatorChangeNotification. It acts as a bridge between the view (IRealtimeSettingsView) and underlying system events, without containing business logic itself.
2. Public Interface
Constructor
public RealtimeSettingsViewModel(
IRealtimeSettingsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
- Initializes the view model, sets up the view context, registers event subscriptions, and initializes interaction requests.
Methods
-
void Cleanup()
No-op stub; intended for cleanup logic but currently does nothing. -
Task CleanupAsync()
ReturnsTask.CompletedTask; no-op async stub. -
void Initialize()
No-op stub. -
void Initialize(object parameter)
No-op stub. -
void Initialize(object parameter, object model)
No-op stub. -
Task InitializeAsync()
ReturnsTask.CompletedTask; no-op async stub. -
Task InitializeAsync(object parameter)
ReturnsTask.CompletedTask; no-op async stub. -
void Activated()
No-op stub; likely part of Prism’sINavigationAwareor region lifecycle, but unimplemented.
Properties
-
IRealtimeSettingsView View { get; }
Reference to the associated view instance. -
InteractionRequest<Notification> NotificationRequest { get; }
Prism interaction request used to trigger notification popups. -
InteractionRequest<Confirmation> ConfirmationRequest { get; }
Prism interaction request used to trigger confirmation dialogs. -
string RealtimeSampleRate { get; set; }
Binds to the currently selected sample rate string (e.g.,"48 kHz"). Triggers property change notification. -
string RealtimeSampleRates { get; set; }
Binds to a list or set of available sample rates (e.g.,"44.1 kHz, 48 kHz"). On change, also raisesOnPropertyChanged("RealtimeSampleRate"). -
string RealtimeDelayText { get; set; }
Binds to the delay value display text (e.g.,"12.5 ms"). -
bool IsDirty { get; }
Read-only flag indicating whether the view model state has unsaved changes. Currently alwaysfalse; no logic to update it. -
bool IsBusy { get; set; }
Controls busy indicator visibility. Set viaOnBusyIndicatorNotification(bool)event handler. -
bool IsMenuIncluded { get; set; }
Controls whether the menu is visible in the view. -
bool IsNavigationIncluded { get; set; }
Controls whether navigation controls are visible in the view. -
string HeaderInfo { get; }
Returns the constant"MainRegion"; likely used for region naming or header labeling.
3. Invariants
View.DataContextis always set tothisduring construction._eventAggregatorsubscriptions are established in the constructor and never unsubscribed (potential memory leak risk).RealtimeSampleRatessetter always triggersOnPropertyChanged("RealtimeSampleRate"), implying thatRealtimeSampleRateis derived or dependent onRealtimeSampleRates.IsDirtyis declared but never updated—its value is alwaysfalse.IsBusyis updated only via theOnBusyIndicatorNotification(bool)handler, which is subscribed toBusyIndicatorChangeNotification.NotificationRequestis raised only viaOnRaiseNotification(NotificationContentEventArgs), which wraps the incomingeventArgsWithTitleinto aNotificationobject with aNotificationContentEventArgs(with empty title and footer fields) and aTitletaken from the event args.
4. Dependencies
Imports / Dependencies
- MEF:
[Export(typeof(IRealtimeSettingsView))]and[PartCreationPolicy(CreationPolicy.Shared)]indicate this class is a shared MEF component. - Prism: Uses
IEventAggregator,IRegionManager,InteractionRequest<T>, and likelyINavigationAware(viaActivated()). - Unity:
IUnityContaineris injected for dependency resolution. - Custom Types:
IRealtimeSettingsView(view interface)BasePropertyChanged(base class forINotifyPropertyChanged)RaiseNotification,BusyIndicatorChangeNotification(event types fromDTS.Common.Events)NotificationContentEventArgs,Notification,NotificationContentEventArgsWithoutTitle(fromDTS.Common.Interactivity)NotificationWindow,PopupWindowAction(referenced in comments, likely inDTS.Common.Interfaceor.Infrastructure)
Depended Upon
- The module is exported as
IRealtimeSettingsView, so it is consumed by the shell or region manager when theRealtimeSettingsview is requested.
5. Gotchas
- No-op lifecycle methods:
Initialize(),InitializeAsync(),Activated(),Cleanup(), andCleanupAsync()are all empty stubs. Any initialization or cleanup logic must be added manually—no behavior is implemented. IsDirtyis never set: The property exists but is never updated; it remainsfalsefor the lifetime of the object. If dirty tracking is required, this must be implemented.- Event subscriptions are never unsubscribed:
_eventAggregator.GetEvent<...>().Subscribe(...)calls lackUnsubscribe()calls, which may cause memory leaks or unexpected behavior if the view model is disposed but events continue firing. RealtimeSampleRatessetter triggersRealtimeSampleRatechange: This impliesRealtimeSampleRateis logically derived fromRealtimeSampleRates, but no parsing or validation is done in the setter. Consumers must ensureRealtimeSampleRateis a valid value fromRealtimeSampleRates.NotificationContentEventArgsconstructor usage is non-obvious: TheOnRaiseNotificationmethod constructs a newNotificationContentEventArgs(...)with empty strings for title and footer, then wraps it in aNotificationobject. This suggests a mismatch between event payload structure and popup expectation—potential source of confusion or UI misrendering.- No validation on sample rate/delay fields:
RealtimeSampleRateandRealtimeDelayTextare plain strings with no validation or formatting logic in the view model. - Comments reference outdated/incorrect types: The
OnRaiseNotificationcomment mentionsNotificationContentEventArgsWithoutTitle, but the code instantiatesNotificationContentEventArgsdirectly. This may indicate legacy or incomplete documentation.
No additional behavior is evident from the source beyond what is described.