init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SystemSettings/RealtimeSettings/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:42:54.865293+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3833939a0a078d0f"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### **1. Purpose**
|
||||
This module (`DataPRO.Modules.SystemSettings.RealtimeSettings`) is an assembly containing metadata and configuration attributes for a .NET component related to real-time system settings within the broader DataPRO platform. Its primary purpose is to define assembly-level metadata (such as title, version, and COM visibility) rather than implement business logic. It serves as a foundational infrastructure component, likely referenced by other modules that consume or manage real-time configuration data.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
This file contains **no public types, functions, classes, or methods**. It is an `AssemblyInfo.cs` file that exclusively defines assembly-level attributes via attributes applied to the assembly itself (e.g., `AssemblyTitle`, `AssemblyVersion`). There are no executable or declarable public APIs exposed by this module.
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- The assembly is **not visible to COM** (`ComVisible(false)`), meaning it is not intended for interop with COM clients.
|
||||
- The assembly version is fixed at `1.0.0.0` for both `AssemblyVersion` and `AssemblyFileVersion`.
|
||||
- The GUID `7446722e-490d-4f6a-beaf-907947e576d5` is permanently assigned as the typelib ID (used only if COM visibility were enabled).
|
||||
- All assembly attributes are static and immutable at runtime.
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
- **Depends on**:
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
These are standard .NET framework namespaces for reflection, runtime compilation, and COM interop support.
|
||||
|
||||
- **Depended on by**:
|
||||
- Unknown from this file alone. As an `AssemblyInfo.cs`, this module does not directly depend on or get consumed by other modules in a functional sense. However, other modules in the `DataPRO` solution likely reference this assembly (e.g., `DataPRO.Modules.SystemSettings`) to access its types or metadata.
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **No runtime logic**: Developers should not expect any executable code or stateful behavior from this module. Misinterpreting it as a functional module may lead to confusion about where real-time settings logic resides.
|
||||
- **Versioning rigidity**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`, which may indicate legacy status or a need for CI/CD integration to auto-increment versions.
|
||||
- **COM support disabled**: If future integration with COM-based tools is required, `ComVisible(true)` and a stable typelib GUID must be explicitly configured—this is currently not the case.
|
||||
- **Missing documentation**: `AssemblyDescription` and `AssemblyCompany` are empty strings, suggesting incomplete metadata or reliance on external documentation.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,100 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SystemSettings/RealtimeSettings/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/SystemSettings/RealtimeSettings/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:42:50.978478+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2a6f478ba4a248f4"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` and `StringResources`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides localized string support for the `RealtimeSettings` UI layer in a WPF application. It consists of two tightly coupled components:
|
||||
- `TranslateExtension`, a XAML markup extension enabling declarative localization in XAML (e.g., `{local:Translate KeyName}`), and
|
||||
- `StringResources`, a strongly-typed, auto-generated resource class that wraps access to embedded string resources (`.resx`-backed).
|
||||
Together, they allow UI elements to display culture-sensitive text without hardcoding strings, supporting runtime language switching via `StringResources.Culture`.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `TranslateExtension` class
|
||||
- **Namespace**: `RealtimeSettings.Resources`
|
||||
- **Base class**: `System.Windows.Markup.MarkupExtension`
|
||||
- **Attributes**: `[MarkupExtensionReturnType(typeof(string))]`
|
||||
|
||||
| Member | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| **Constructor** | `public TranslateExtension(string key)` | Stores the resource key (`_key`) for later lookup. Does not validate key format or existence. |
|
||||
| **ProvideValue** | `public override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key` using `StringResources.ResourceManager.GetString(_key)`. If `_key` is `null`/empty or lookup fails, returns a fallback string (see *Invariants*). |
|
||||
|
||||
#### `StringResources` class
|
||||
- **Namespace**: `RealtimeSettings.Resources`
|
||||
- **Attributes**: `[GeneratedCode]`, `[DebuggerNonUserCode]`, `[CompilerGenerated]`
|
||||
- **Visibility**: `internal` (not public)
|
||||
|
||||
| Member | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| **ResourceManager** | `internal static ResourceManager ResourceManager { get; }` | Lazily initializes and returns a `ResourceManager` for the `RealtimeSettings.Resources.StringResources` resource file (embedded in the assembly). |
|
||||
| **Culture** | `internal static CultureInfo Culture { get; set; }` | Gets/sets the UI culture used for resource lookups. Affects all subsequent `GetString` calls. |
|
||||
| **Static properties** | e.g., `internal static string DelayBetweenPolls { get; }` | Each property performs a `ResourceManager.GetString("KeyName")` call. Property names match resource keys (e.g., `"DelayBetweenPolls"`). |
|
||||
|
||||
**Notable string keys defined in `StringResources`**:
|
||||
- `DelayBetweenPolls`, `DelayBetweenPollsHelp`
|
||||
- `HighDelay`, `HighDelayHelp`
|
||||
- `LowDelay`, `LowDelayHelp`
|
||||
- `RealtimeSampleRate`, `RealtimeSampleRates`, `RealtimeSampleRateSliceIP`, `RealtimeSampleRateSliceUSB`, `RealtimeSampleRateTDASG5`
|
||||
- `SampleRate`, `SampleRateHelp`
|
||||
- `UseMeterModeHelp`, `UseMeterModeTableStyle`
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Key validation**:
|
||||
- If `_key` passed to `TranslateExtension` is `null` or empty (`""`), `ProvideValue` returns `"#stringnotfound#"`.
|
||||
- If `StringResources.ResourceManager.GetString(_key)` returns `null` (key not found), `ProvideValue` returns `"#stringnotfound# " + _key` (e.g., `"#stringnotfound# MissingKey"`).
|
||||
- **Resource key consistency**:
|
||||
- `StringResources` properties are generated from keys in the `.resx` file. The key used in `TranslateExtension(key)` must exactly match the resource name (e.g., `"DelayBetweenPolls"`), including case.
|
||||
- **Thread-safety**:
|
||||
- `StringResources.ResourceManager` is thread-safe (uses `Lazy<T>`-like pattern via `ReferenceEquals` check).
|
||||
- `StringResources.Culture` is *not* thread-safe; concurrent writes may cause race conditions.
|
||||
- **Fallback behavior**:
|
||||
- No exception is thrown for missing keys—only fallback strings. This avoids runtime crashes but may result in visible placeholder text.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Depends on**
|
||||
- `System.Windows.Markup` (for `MarkupExtension` base class)
|
||||
- `System.Resources` (via `ResourceManager`)
|
||||
- `System.Globalization` (for `CultureInfo`)
|
||||
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices` (auto-generated attributes)
|
||||
- **Embedded resource**: `RealtimeSettings.Resources.StringResources.resources` (compiled from `StringResources.resx`)
|
||||
|
||||
#### **Depended on by**
|
||||
- **WPF XAML files** in the `RealtimeSettings` module (e.g., `*.xaml` pages) using `{local:Translate KeyName}` syntax.
|
||||
- **UI code-behind** may directly access `StringResources` properties (e.g., `StringResources.DelayBetweenPolls`) for non-XAML localization.
|
||||
- **No other modules** appear to depend on this (based on namespace isolation: `RealtimeSettings.Resources`).
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Hardcoded fallback prefix**: The `"#stringnotfound#"` prefix is hardcoded in `TranslateExtension`—not configurable or localized itself.
|
||||
- **No null-safety for `serviceProvider`**: `ProvideValue` does not validate `serviceProvider` (though WPF always provides one during XAML parsing).
|
||||
- **Case sensitivity**: Resource keys are case-sensitive. A typo like `"delaybetweenpolls"` (lowercase) will fail lookup.
|
||||
- **Designer file warnings**: `StringResources.Designer.cs` explicitly warns that manual changes are lost on regeneration. Modifying `.resx` requires rebuilding to sync `StringResources`.
|
||||
- **Culture persistence**: `StringResources.Culture` only affects *new* lookups; existing `TranslateExtension` instances retain the culture at instantiation time (since `ProvideValue` is called at XAML parse time).
|
||||
- **No support for pluralization/formatting**: `TranslateExtension` only returns raw strings. Placeholders (e.g., `{0}`) are possible in `.resx` but must be manually handled in XAML (e.g., `String.Format` in code-behind).
|
||||
- **No localization for non-string resources**: Only strings are supported; no support for images, icons, etc.
|
||||
|
||||
None identified beyond these.
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SystemSettings/RealtimeSettings/View/RealtimeSettingsView.xaml.cs
|
||||
generated_at: "2026-04-16T04:42:57.437879+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b34a084e20af6733"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
1. **Purpose**
|
||||
This module defines the WPF view class `RealtimeSettingsView`, which serves as the UI layer for the real-time settings feature. It implements the `IRealtimeSettingsView` interface (from `DTS.Common.Interface`) and is responsible for rendering the user interface defined in `RealtimeSettingsView.xaml`. Its role is to provide a concrete implementation of the view contract, enabling dependency injection and separation of concerns in the MVVM (Model-View-ViewModel) architecture used by the system.
|
||||
|
||||
2. **Public Interface**
|
||||
- `RealtimeSettingsView()`
|
||||
Public parameterless constructor. Calls `InitializeComponent()` to instantiate and wire up UI elements defined in `RealtimeSettingsView.xaml`. No additional initialization logic is present in the provided source.
|
||||
|
||||
3. **Invariants**
|
||||
- The class must be instantiated on the UI thread (as it is a WPF `UserControl`-derived type, implicitly via `InitializeComponent()`), though the base type is not explicitly shown, standard WPF conventions apply.
|
||||
- `InitializeComponent()` must be called exactly once during construction; calling it again may cause runtime exceptions (e.g., duplicate names in XAML).
|
||||
- The class implements `IRealtimeSettingsView`, so it must conform to that interface’s contract (though the interface definition is external and not provided here).
|
||||
|
||||
4. **Dependencies**
|
||||
- **External dependency**: `DTS.Common.Interface.IRealtimeSettingsView` — the interface this view implements; its definition is in an external assembly (`DTS.Common.Interface.dll` or similar).
|
||||
- **Internal dependency**: `RealtimeSettingsView.xaml` — the XAML file defining the visual structure; `InitializeComponent()` is auto-generated from this file.
|
||||
- **Inferred usage**: This view is likely consumed by a ViewModel or controller that depends on `IRealtimeSettingsView`, enabling testability and decoupling.
|
||||
|
||||
5. **Gotchas**
|
||||
- The constructor contains no additional logic beyond `InitializeComponent()`. Any initialization requiring data binding or ViewModel setup must occur in the ViewModel or via code-behind hooks (e.g., `Loaded` event), not here.
|
||||
- No error handling or validation is present in the constructor; failures in `InitializeComponent()` (e.g., malformed XAML) will result in runtime exceptions during view instantiation.
|
||||
- The class is `partial`, implying the remainder of the implementation resides in the auto-generated `RealtimeSettingsView.g.i.cs` file (not provided), which contains the `InitializeComponent()` method and field declarations for named XAML elements.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,136 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SystemSettings/RealtimeSettings/ViewModel/RealtimeSettingsViewModel.cs
|
||||
generated_at: "2026-04-16T04:42:47.252875+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "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**
|
||||
```csharp
|
||||
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()`
|
||||
Returns `Task.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()`
|
||||
Returns `Task.CompletedTask`; no-op async stub.
|
||||
|
||||
- `Task InitializeAsync(object parameter)`
|
||||
Returns `Task.CompletedTask`; no-op async stub.
|
||||
|
||||
- `void Activated()`
|
||||
No-op stub; likely part of Prism’s `INavigationAware` or 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 raises `OnPropertyChanged("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 always `false`; no logic to update it.
|
||||
|
||||
- `bool IsBusy { get; set; }`
|
||||
Controls busy indicator visibility. Set via `OnBusyIndicatorNotification(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.DataContext` is always set to `this` during construction.
|
||||
- `_eventAggregator` subscriptions are established in the constructor and never unsubscribed (potential memory leak risk).
|
||||
- `RealtimeSampleRates` setter *always* triggers `OnPropertyChanged("RealtimeSampleRate")`, implying that `RealtimeSampleRate` is derived or dependent on `RealtimeSampleRates`.
|
||||
- `IsDirty` is declared but never updated—its value is *always* `false`.
|
||||
- `IsBusy` is updated *only* via the `OnBusyIndicatorNotification(bool)` handler, which is subscribed to `BusyIndicatorChangeNotification`.
|
||||
- `NotificationRequest` is raised *only* via `OnRaiseNotification(NotificationContentEventArgs)`, which wraps the incoming `eventArgsWithTitle` into a `Notification` object with a `NotificationContentEventArgs` (with empty title and footer fields) and a `Title` taken 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 likely `INavigationAware` (via `Activated()`).
|
||||
- **Unity**: `IUnityContainer` is injected for dependency resolution.
|
||||
- **Custom Types**:
|
||||
- `IRealtimeSettingsView` (view interface)
|
||||
- `BasePropertyChanged` (base class for `INotifyPropertyChanged`)
|
||||
- `RaiseNotification`, `BusyIndicatorChangeNotification` (event types from `DTS.Common.Events`)
|
||||
- `NotificationContentEventArgs`, `Notification`, `NotificationContentEventArgsWithoutTitle` (from `DTS.Common.Interactivity`)
|
||||
- `NotificationWindow`, `PopupWindowAction` (referenced in comments, likely in `DTS.Common.Interface` or `.Infrastructure`)
|
||||
|
||||
#### **Depended Upon**
|
||||
- The module is exported as `IRealtimeSettingsView`, so it is consumed by the shell or region manager when the `RealtimeSettings` view is requested.
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
|
||||
- **No-op lifecycle methods**: `Initialize()`, `InitializeAsync()`, `Activated()`, `Cleanup()`, and `CleanupAsync()` are all empty stubs. Any initialization or cleanup logic must be added manually—no behavior is implemented.
|
||||
- **`IsDirty` is never set**: The property exists but is never updated; it remains `false` for the lifetime of the object. If dirty tracking is required, this must be implemented.
|
||||
- **Event subscriptions are never unsubscribed**: `_eventAggregator.GetEvent<...>().Subscribe(...)` calls lack `Unsubscribe()` calls, which may cause memory leaks or unexpected behavior if the view model is disposed but events continue firing.
|
||||
- **`RealtimeSampleRates` setter triggers `RealtimeSampleRate` change**: This implies `RealtimeSampleRate` is *logically* derived from `RealtimeSampleRates`, but no parsing or validation is done in the setter. Consumers must ensure `RealtimeSampleRate` is a valid value from `RealtimeSampleRates`.
|
||||
- **`NotificationContentEventArgs` constructor usage is non-obvious**: The `OnRaiseNotification` method constructs a new `NotificationContentEventArgs(...)` with empty strings for title and footer, then wraps it in a `Notification` object. 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**: `RealtimeSampleRate` and `RealtimeDelayText` are plain strings with no validation or formatting logic in the view model.
|
||||
- **Comments reference outdated/incorrect types**: The `OnRaiseNotification` comment mentions `NotificationContentEventArgsWithoutTitle`, but the code instantiates `NotificationContentEventArgs` directly. This may indicate legacy or incomplete documentation.
|
||||
|
||||
---
|
||||
|
||||
*No additional behavior is evident from the source beyond what is described.*
|
||||
Reference in New Issue
Block a user