Files
DP44/docs/ai/DataPRO/Modules/Realtime/RealtimeModule/ViewModel.md
2026-04-17 14:55:32 -04:00

3.7 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/Realtime/RealtimeModule/ViewModel/RealtimeChannelSelectViewModel.cs
2026-04-17T16:15:36.171229+00:00 zai-org/GLM-5-FP8 1 24dfd3094a915001

ViewModel

Purpose

This ViewModel manages the Realtime channel selection UI logic. It handles filtering and displaying available realtime channels, responding to user search input, publishing channel selection events, and responding to global notification events (busy indicator and notifications). It acts as the intermediary between the View and the event aggregation system.

Public Interface

RealtimeChannelSelectViewModel (class)

  • Implements IRealtimeChannelSelectViewModel
  • RealtimeChannelSelectViewModel(IRealtimeChannelSelectView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer) - Constructor that wires up the view, sets DataContext, initializes interaction requests, and subscribes to events.

Properties:

  • IRealtimeChannelSelectView ChannelSelectView { get; set; } - The associated view.
  • InteractionRequest<Notification> NotificationRequest { get; } - For raising notification popups.
  • InteractionRequest<Confirmation> ConfirmationRequest { get; } - For raising confirmation dialogs.
  • IRealtimeChannel[] RealtimeChannels { get; set; } - Filtered channels displayed to user; defaults to empty array.
  • bool IsDirty { get; } - Always returns false.
  • bool IsBusy { get; set; } - Bound to busy indicator; notifies on change.
  • bool IsMenuIncluded { get; set; } - Notifies on change.
  • bool IsNavigationIncluded { get; set; } - Notifies on change.

Methods:

  • void SetAvailableChannels(IRealtimeChannel[] channels) - Sets _allChannels and calls Filter().
  • void SetSearchText(string searchText) - Sets _searchTerm and calls Filter().
  • void SetRealtimeChannel(IRealtimeChannel channel) - Publishes RealtimeChannelSelectedEvent with the selected channel.
  • void OnPropertyChanged(string propertyName) - Raises PropertyChanged event.
  • void Unset() - Empty.
  • void Cleanup() - Empty.
  • Task CleanupAsync() - Returns Task.CompletedTask.
  • void Initialize() - Empty.
  • void Initialize(object parameter) - Empty.
  • void Initialize(object parameter, object model) - Empty.
  • Task InitializeAsync() - Returns Task.CompletedTask.
  • Task InitializeAsync(object parameter) - Returns Task.CompletedTask.
  • void Activated() - Empty.

Events:

  • event PropertyChangedEventHandler PropertyChanged - Implements INotifyPropertyChanged.

Invariants

  • RealtimeChannels is never null (initialized to empty array).
  • _allChannels is private and only modified via SetAvailableChannels.
  • Filter() is always called after modifying _searchTerm or _allChannels.
  • The ViewModel is created as a shared singleton ([PartCreationPolicy(CreationPolicy.Shared)]).
  • Event subscriptions use ThreadOption.PublisherThread for BusyIndicatorChangeNotification with keepSubscriberReferenceAlive = true.

Dependencies

Depends on:

  • DTS.Common.Events - Provides NotificationContentEventArgs.
  • DTS.Common.Events.Realtime - Provides RaiseNotification, BusyIndicatorChangeNotification, RealtimeChannelSelectedEvent.
  • DTS.Common.Interactivity - Provides InteractionRequest<T>, Notification, Confirmation.
  • DTS.Common.Interface.Realtime - Provides IRealtimeChannel, IRealtimeChannelSelectView, IRealtimeChannelSelectViewModel.
  • Prism.Events - Provides IEventAggregator, ThreadOption.
  • Prism.Regions - Provides IRegionManager.
  • Unity - Provides IUnityContainer.

Depended on by:

  • RealtimeModule (registers and resolves this