This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T13:50:25.888352+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "aa69b1de52a95e40"
---
# Properties
## 1. Purpose
This file provides assembly-level metadata attributes for the `DTS.Viewer.ViewerSettings` module. It defines identity information (title, product), versioning details, and COM visibility settings for the compiled .NET assembly. It serves as the standard assembly manifest configuration, typically auto-generated by Visual Studio for .NET Framework projects, to identify the module within the larger "DTS Viewer" application ecosystem.
## 2. Public Interface
This file does not contain public classes or methods. Instead, it configures the following assembly-level attributes:
* **`AssemblyTitle`**: Set to `"DTS.Viewer.ViewerSettings"`. Provides a friendly name for the assembly.
* **`AssemblyDescription`**: Set to an empty string.
* **`AssemblyProduct`**: Set to `"DTS.Viewer.ViewerSettings"`. Provides product information.
* **`AssemblyCopyright`**: Set to `"Copyright © 2019"`.
* **`ComVisible`**: Set to `false`. Ensures types within this assembly are not visible to COM components by default.
* **`Guid`**: Set to `"4733690a-cb08-4c2e-853a-9339be13ac28"`. A unique identifier for the assembly, used if the project is exposed to COM.
* **`AssemblyVersion`**: Set to `"1.0.0.0"`. Defines the version of the assembly used by the common language runtime.
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`. Defines the file version number displayed on the file properties.
## 3. Invariants
* **COM Visibility:** Types within this assembly are explicitly hidden from COM components (`ComVisible(false)`).
* **Versioning:** Both the assembly version and file version are fixed at `1.0.0.0`.
* **Identity:** The `Guid` is constant and uniquely identifies this specific assembly module.
## 4. Dependencies
* **Imports:**
* `System.Reflection`
* `System.Runtime.CompilerServices`
* `System.Runtime.InteropServices`
* **Dependents:** The compiled assembly (`DTS.Viewer.ViewerSettings.dll`) is the direct consumer of this metadata. Other modules within the "DTS Viewer" solution may reference this assembly, but they do not depend on this specific source file directly.
## 5. Gotchas
* **Hardcoded Versions:** The `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`. Unlike modern SDK-style projects which may derive versioning from build pipelines, this file requires manual updates or a build task to modify version numbers for new releases.
* **Empty Description:** The `AssemblyDescription` attribute is explicitly empty, which may result in missing metadata in assembly browsers or deployment tools.
* **Stale Copyright:** The copyright string is hardcoded to 2019. If the codebase is active, this date is likely outdated.

View File

@@ -0,0 +1,73 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/Resources/TranslateExtension.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T13:50:32.426485+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b58f3ee343f377b9"
---
# Documentation: DTS.Viewer.ViewerSettings.Resources
## 1. Purpose
This module provides localization infrastructure for the `DTS.Viewer.ViewerSettings` namespace. It consists of a strongly-typed resource accessor class (`StringResources`) generated from a `.resx` file, and a XAML markup extension (`TranslateExtension`) that allows UI elements to bind directly to localized strings using the resource keys. This separates user-facing text from code logic and supports multi-language deployments.
## 2. Public Interface
### `TranslateExtension`
**Location:** `DTS.Viewer.ViewerSettings`
**Inheritance:** `System.Windows.Markup.MarkupExtension`
A XAML markup extension used to resolve localized strings in the UI layer.
* **`TranslateExtension(string key)`**
* Constructor that accepts the resource key to be translated.
* **`object ProvideValue(IServiceProvider serviceProvider)`**
* Returns the localized string corresponding to the `_key`.
* Returns `#stringnotfound#` if the key is null or empty.
* Returns `#stringnotfound# {key}` if the lookup fails for a specific key.
### `StringResources`
**Location:** `DTS.Viewer.ViewerSettings.Resources`
**Attributes:** `internal`, Auto-generated
A strongly-typed resource class providing access to localized strings.
* **`static global::System.Resources.ResourceManager ResourceManager`**
* Returns the cached `ResourceManager` instance for this assembly.
* **`static global::System.Globalization.CultureInfo Culture`**
* Gets or sets the `CultureInfo` used for resource lookups. Overrides the current thread's `CurrentUICulture`.
* **`static string CalibrationBehavior_LinearIfAvailable`**
* Resource string: "Use the linear sensitivity, if available."
* **`static string CalibrationBehavior_NonLinearIfAvailable`**
* Resource string: "Use the non-linear sensitivity, if available."
* **`static string CalibrationBehavior_UseBothIfAvailable`**
* Resource string: "Use both sensitivities, if available, as separate channels."
* **`static string CalibrationBehaviorText`**
* Resource string: "Calibration Behavior".
## 3. Invariants
* **Non-Null Return:** `TranslateExtension.ProvideValue` always returns a string; it never returns null. It guarantees a fallback string if the resource is missing.
* **Fallback Format:** If a resource key is valid but not found, the return value follows the format `#stringnotfound# {key}`.
* **Empty Key Handling:** If the key passed to `TranslateExtension` is null or empty, the return value is exactly `#stringnotfound#` (without a trailing space or key name).
* **Visibility:** `StringResources` is marked `internal`, restricting access to within the assembly.
* **Code Generation:** `StringResources` is auto-generated; manual edits to the file will be overwritten by the tooling (ResGen/Visual Studio).
## 4. Dependencies
* **Internal Dependencies:**
* `TranslateExtension` depends on `StringResources` to perform the actual resource lookup via `StringResources.ResourceManager`.
* **External Framework Dependencies:**
* `System.Windows.Markup`: Required for `MarkupExtension` and `IServiceProvider` (WPF specific).
* `System.Resources`: Required for `ResourceManager`.
* `System.Globalization`: Required for `CultureInfo`.
* **File Dependencies:**
* `StringResources.Designer.cs` depends on an underlying `.resx` file (likely `StringResources.resx`) which contains the actual key-value pairs for the localized strings.
## 5. Gotchas
* **Culture Inconsistency:** `TranslateExtension` calls `StringResources.ResourceManager.GetString(_key)` without passing a culture argument. This relies on `Thread.CurrentUICulture`. However, `StringResources` exposes a static `Culture` property. If a developer sets `StringResources.Culture` explicitly, the strongly-typed properties (e.g., `CalibrationBehaviorText`) will respect it, but `TranslateExtension` will **ignore** it and continue using the thread's current UI culture.
* **Silent Failures:** The `TranslateExtension` does not throw exceptions for missing keys. Instead, it returns the error string `#stringnotfound#`. This is designed for debugging visibility but requires visual inspection of the UI to detect missing translations.
* **Designer File Edits:** Because `StringResources.Designer.cs` is auto-generated, developers must not add custom logic or properties directly to this class. Changes must be made in the corresponding `.resx` file.

View File

@@ -0,0 +1,57 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/View/ViewerSettingsView.xaml.cs
generated_at: "2026-04-16T13:50:42.982175+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "499d220096c49a25"
---
# Documentation: ViewerSettingsView.xaml.cs
## 1. Purpose
This module provides the code-behind implementation for `ViewerSettingsView`, a WPF User Control that serves as the UI component for configuring viewer settings within the DTS Viewer application. It implements the `IViewerSettingsView` interface, indicating it follows a view abstraction pattern (likely MVP or MVVM), allowing the view to be consumed by a presenter or view model without direct coupling to the concrete implementation.
## 2. Public Interface
### `ViewerSettingsView` (class)
**Kind:** `public partial class`
**Implements:** `IViewerSettingsView`
**Location:** Namespace `DTS.Viewer.ViewerSettings`
#### Constructor
```csharp
public ViewerSettingsView()
```
Initializes a new instance of the `ViewerSettingsView` class. Calls `InitializeComponent()`, which loads and instantiates the associated XAML-defined UI element tree.
---
**Note:** No other public members are defined in this code-behind file. Any additional public properties, commands, or event handlers would be defined in the accompanying XAML file or generated as part of the partial class definition.
## 3. Invariants
- The class is `partial`, meaning it must be paired with a corresponding XAML file (`ViewerSettingsView.xaml`) that defines the UI layout.
- `InitializeComponent()` must be called exactly once during construction; this is generated code from the XAML and is essential for the control to function.
- The class implements `IViewerSettingsView`, so it must satisfy all members defined by that interface (interface members are not visible in this source alone).
## 4. Dependencies
### This module depends on:
- **`DTS.Common.Interface`** — Provides the `IViewerSettingsView` interface contract.
- **WPF Framework** (`System.Windows.*`) — Core WPF types for user controls, controls, data binding, input, and media rendering.
### What depends on this module:
- **Unclear from source alone.** Consumers would include whatever module instantiates or resolves `ViewerSettingsView` (likely a presenter, view model, or DI container configuration).
## 5. Gotchas
- **Unused using directives:** The file imports `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`, and several WPF namespaces that are not referenced anywhere in the code. These are likely remnants of the Visual Studio item template and could be removed.
- **Interface contract unknown:** The requirements of `IViewerSettingsView` are not visible in this source. Developers must consult `DTS.Common.Interface` to understand what members this view must implement.
- **No observable behavior:** The code-behind contains only the constructor. All meaningful interaction logic is presumably handled via XAML bindings, code-behind event handlers not shown here, or is entirely delegated to a view model.

View File

@@ -0,0 +1,120 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/ViewModel/ViewerSettingsViewModel.cs
generated_at: "2026-04-16T13:49:48.286150+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f93455d3d5a535ba"
---
# Documentation: ViewerSettingsViewModel
## 1. Purpose
`ViewerSettingsViewModel` is a Prism-based view model for the Viewer Settings module within the DTS Viewer application. It manages user-configurable settings related to calibration behaviors, handles visibility states for settings UI elements, and coordinates with parent view models via event aggregation. The class serves as the binding context for `IViewerSettingsView` and participates in the application's region-based navigation system.
---
## 2. Public Interface
### Constructor
```csharp
public ViewerSettingsViewModel(
IViewerSettingsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the view model, sets the view's DataContext to itself, and creates `NotificationRequest` and `ConfirmationRequest` interaction requests.
### Methods
```csharp
public override void Initialize()
```
Empty override. No initialization logic performed.
```csharp
public override void Initialize(object parameter)
```
Sets `Parent` property from the provided parameter (cast to `IBaseViewModel`) and calls `Subscribe()` to register event handlers.
```csharp
public void PublishChanges()
```
Empty implementation. No behavior defined in source.
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IViewerSettingsView` | Gets/sets the associated view interface. |
| `Parent` | `IBaseViewModel` | Gets/sets the parent view model reference. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notifications. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations (hides base member with `new`). |
| `HeaderInfo` | `string` | Returns constant string `"SettingsRegion"`. |
| `IsBusy` | `bool` | Gets/sets busy state (hides base member with `new`). |
| `IsDirty` | `bool` | Gets/sets dirty state (hides base member with `new`). |
| `IsNavigationIncluded` | `bool` | Gets/sets navigation inclusion flag (hides base member with `new`). |
| `CalibrationBehaviorSettingVisibility` | `Visibility` | Controls visibility of calibration behavior setting UI. Publishes `ViewerSettingsVisibilityChangedEvent` when changed. |
| `OverallSettingsVisibility` | `Visibility` | Computed property; returns `Visibility.Visible` if `CalibrationBehaviorSettingVisibility` is visible, otherwise `Visibility.Collapsed`. |
| `AvailableCalibrationBehaviors` | `DisplayedCalibrationBehavior[]` | Lazily-initialized, thread-safe array of three calibration behavior options: `_linearIfAvail`, `_nonLinearIfAvail`, `_useBothIfAvail`. |
| `CalibrationBehaviorSetting` | `DisplayedCalibrationBehavior` | Gets/sets the selected calibration behavior. Defaults to `CalibrationBehaviors.NonLinearIfAvailable`. Publishes `CalibrationBehaviorSettingChangedEvent` when changed. |
### Events
```csharp
public new event PropertyChangedEventHandler PropertyChanged
```
Hides base class event. Raised via `OnPropertyChanged(string)`.
---
## 3. Invariants
- **Default Calibration Behavior**: `_calibrationBehaviorSetting` is always initialized to `CalibrationBehaviors.NonLinearIfAvailable`.
- **OverallSettingsVisibility Dependency**: `OverallSettingsVisibility` is always `Visibility.Collapsed` when `CalibrationBehaviorSettingVisibility` is `Visibility.Collapsed`. It cannot be visible independently.
- **Thread Safety**: `AvailableCalibrationBehaviors` getter uses a lock (`MyLock`) to ensure thread-safe lazy initialization.
- **CalibrationBehaviorSetting Getter**: Always returns a matching `DisplayedCalibrationBehavior` from `AvailableCalibrationBehaviors` array, or `null` if no match found.
- **Event Subscription Timing**: Subscriptions occur only after `Initialize(object parameter)` is called, not in the constructor.
---
## 4. Dependencies
### External Dependencies (from imports)
- **Prism.Events** - `IEventAggregator` for pub/sub messaging
- **Prism.Regions** - `IRegionManager` for region-based navigation
- **Unity** - `IUnityContainer` for dependency injection
- **DTS.Common.Base** - `BaseViewModel<T>`, `IBaseViewModel`
- **DTS.Common.Classes.Sensors** - `DisplayedCalibrationBehavior`
- **DTS.Common.Enums.Sensors** - `CalibrationBehaviors` enum
- **DTS.Common.Events** - `CalibrationBehaviorSettingChangedEvent`, `CalibrationBehaviorSettableInViewerChangedEvent`, `ViewerSettingsVisibilityChangedEvent`
- **DTS.Common.Interactivity** - `InteractionRequest<T>`, `Notification`, `Confirmation`
- **DTS.Common.Interface** - `IViewerSettingsViewModel`
- **System.Windows** - `Visibility` enum
### Consumed Events
- `CalibrationBehaviorSettingChangedEvent` - payload: `CalibrationBehaviors`
- `CalibrationBehaviorSettableInViewerChangedEvent` - payload: `bool`
### Published Events
- `CalibrationBehaviorSettingChangedEvent` - published when `CalibrationBehaviorSetting` setter is invoked with a different value
- `ViewerSettingsVisibilityChangedEvent` - published when `CalibrationBehaviorSettingVisibility` is set
---
## 5. Gotchas
1. **Misleading XML Documentation**: The constructor's XML comment references `TestSummaryViewListModel`, which appears to be a copy-paste error from another class.
2. **Member Hiding with `new` Keyword**: Multiple members (`PropertyChanged`, `OnPropertyChanged`, `IsBusy`, `IsDirty`, `IsNavigationIncluded`, `ConfirmationRequest`) hide base class members using `new`. This breaks polymorphism—consumers casting to the base type will invoke base implementations, not these overrides.
3. **Empty `PublishChanges()` Method**: The method has no implementation. Its intended purpose is unclear from source alone.
4. **Cascading Visibility Notifications**: `OnPropertyChanged` has special logic—any property name ending with `"Visibility"` (except `"OverallSettingsVisibility"`) triggers an additional `OnPropertyChanged("OverallSettingsVisibility")` call. This side effect is not obvious from property setters alone.
5. **Potential Null Return**: `CalibrationBehaviorSetting` getter returns `null` if `_calibrationBehaviorSetting` does not match any item in `AvailableCalibrationBehaviors`. Callers should handle this possibility.
6. **No Unsubscribe Logic**: The class subscribes to events in `Subscribe()` but does not appear to unsubscribe. Potential memory leak if view model lifecycle is shorter than the event aggregator's.