3.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T16:00:55.338770+00:00 | zai-org/GLM-5-FP8 | 1 | fbd3e29061155d1a |
CachedItemsListViewModel Documentation
1. Purpose
CachedItemsListViewModel is a Prism/MEF view model for the Cached Items List module within the DTS (Data Test System) test setup framework. It serves as the presentation logic layer for displaying and managing cached items—specifically sensors, hardware components, and sensor calibrations—comparing in-memory cached data against database records to identify discrepancies. The class implements the INotifyPropertyChanged pattern and integrates with the application's event aggregation and region management infrastructure.
2. Public Interface
Constructor
public CachedItemsListViewModel(ICachedItemsListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
Initializes the view model, sets the view's DataContext, creates interaction requests, and subscribes to RaiseNotification and BusyIndicatorChangeNotification events.
Properties
| Property | Type | Description |
|---|---|---|
View |
ICachedItemsListView |
The associated view instance. |
NotificationRequest |
InteractionRequest<Notification> |
Used to raise notification dialogs. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Used to raise confirmation dialogs. |
CachedItems |
ICachedItem[] |
Array of cached items. Initialized to empty array. |
IsDirty |
bool |
Always returns false. |
IsBusy |
bool |
Busy indicator state, triggers PropertyChanged. |
IsMenuIncluded |
bool |
Menu inclusion flag, triggers PropertyChanged. |
IsNavigationIncluded |
bool |
Navigation inclusion flag, triggers PropertyChanged. |
HasOutofDateCachedItems |
bool |
Returns true if CachedItems contains any elements. |
HasMissingSensors |
bool |
Returns true if any cached item has DBTime == DateTime.MinValue and ObjectType == Resources.StringResources.Sensor. |
Events
public event PropertyChangedEventHandler PropertyChanged
Standard INotifyPropertyChanged event.
Methods
public void OnPropertyChanged(string propertyName)
Invokes the PropertyChanged event if handlers are attached.
public void Unset()
public void Cleanup()
public Task CleanupAsync()
public void Initialize()
public void Initialize(object parameter)
public void Initialize(object parameter, object model)
public Task InitializeAsync()
public Task InitializeAsync(object parameter)
public void Activated()
Lifecycle methods—currently all empty implementations. CleanupAsync, InitializeAsync, and InitializeAsync(object parameter) return Task.CompletedTask.
public bool SetCachedItems(ISensorData[] sensors, ISensorCalibration[] sensorCalibrations, IDASHardware[] hardware, IDASHardware[] allDAS)
Intended to populate CachedItems by comparing provided sensors, calibrations, and hardware against database records. Currently returns false immediately; all logic is commented out.
3. Invariants
- Singleton lifetime: The class is decorated with
[PartCreationPolicy(CreationPolicy.Shared)], ensuring a single shared instance via MEF. IsDirtyis alwaysfalse: The property has no backing logic to track actual dirty state.CachedItemsis never null: Property is initialized to an empty arraynew ICachedItem[0].- Event subscriptions are keep-subscribed:
BusyIndicatorChangeNotificationis subscribed withkeepSubscriberReferenceAlive: true, preventing weak reference cleanup. HasOutofDateCachedItemsnaming: Despite the name, it simply checks if any items