4.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:56:30.835743+00:00 | zai-org/GLM-5-FP8 | 1 | 85046dce961f12c2 |
Documentation: DTS.Common.BusyIndicatorManager
1. Purpose
This module provides a centralized mechanism for managing busy indicator UI state across an application. It implements a singleton-based manager (BusyIndicatorManager) that tracks multiple concurrent busy operations by unique ID, allowing different parts of the application to show/hide busy indicators without conflicting with each other. The xBusyIndicator class serves as a WPF user control for displaying the busy indicator UI.
2. Public Interface
BusyIndicatorManager (class)
Inherits from: NotificationObject (Microsoft.Practices.Prism.ViewModel)
Singleton Access
public static BusyIndicatorManager Instance { get; }
Returns the singleton instance of BusyIndicatorManager. Thread-safe via lock synchronization on SyncRoot.
Properties
public bool IsBusy { get; }
Indicates whether any busy operation is currently active. Read-only from external callers; set internally via ShowBusy/CloseBusy. Raises PropertyChanged notification.
public string Message { get; }
The current message to display in the busy indicator. Read-only from external callers. Raises PropertyChanged notification.
Methods
public void ShowBusy(int id, string busyMessage)
Registers a busy operation with the given id and displays busyMessage. If the id already exists, updates the message. Sets IsBusy to true and updates Message.
public void CloseBusy(int id)
Removes the busy operation identified by id. If no busy operations remain, sets IsBusy to false and clears Message. If other operations remain, keeps IsBusy as true and sets Message to the last entry's value in busyParameters.
xBusyIndicator (class)
Inherits from: Not explicitly shown; appears to be a WPF partial class (likely UserControl).
public xBusyIndicator()
Default constructor that calls InitializeComponent().
public void Connect(int connectionId, object target)
Method present in the class but implementation is empty. Purpose unclear from source alone.
3. Invariants
- Singleton guarantee: Only one instance of
BusyIndicatorManagercan exist per process. Access is always throughBusyIndicatorManager.Instance. - Thread-safe initialization: The singleton is lazily initialized with lock-based synchronization.
- ID uniqueness: Each busy operation is identified by a unique
intID. Callers are responsible for ensuring IDs do not collide. - State consistency:
IsBusyistrueif and only ifbusyParameters.Count > 0. - Message consistency: When
IsBusyisfalse,Messageis an empty string. WhenIsBusyistrue,Messagereflects the most recently added/updated busy message. - Property change notifications:
IsBusyandMessageraisePropertyChangedviaRaisePropertyChanged()when modified.
4. Dependencies
This module depends on:
Microsoft.Practices.Prism.ViewModel— specificallyNotificationObjectforINotifyPropertyChangedimplementationSystem.Collections.Generic—Dictionary<TKey, TValue>System.Linq—Enumerable.Last()extension methodSystem.Windows.Controls— referenced inxBusyIndicatorXceed.Wpf.Toolkit— referenced inxBusyIndicator(likely provides the actual busy indicator control)
What depends on this module:
- Cannot be determined from source alone. Consumers would bind to
BusyIndicatorManager.Instance.IsBusyandMessageproperties, or instantiatexBusyIndicatorin XAML views.
5. Gotchas
-
xBusyIndicator.Connectis empty: The method signature suggests it may be generated code (common in WPF forIComponentConnector), but the empty implementation has no documented purpose. -
Dictionary ordering assumption:
CloseBusyusesbusyParameters.Last().Valueto determine the next message to display. While .NET Framework 4.7+ and .NET Core preserve insertion order inDictionary, this is not guaranteed by the interface contract. The "last" message may not be the most recently added in all runtime environments. -
No validation of
busyMessage:ShowBusyaccepts any string, includingnullor empty strings, without validation. -
No exception handling for missing IDs in
CloseBusy: The method silently ignores calls to close non-existent IDs (it checksContainsKeybefore removing). -
Message always updated on
ShowBusy: Even if an ID already exists with the same message,Messageis reassigned and property change notification fires, which may trigger unnecessary UI updates.