init
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:12:27.563991+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "aa69b1de52a95e40"
|
||||
---
|
||||
|
||||
# Documentation for AssemblyInfo.cs
|
||||
|
||||
## 1. Purpose
|
||||
This file provides assembly-level metadata configuration for the `DTS.Viewer.ViewerSettings` module. It defines the manifest attributes used by the .NET runtime and hosting environment to identify, version, and configure the compiled assembly. It exists to establish the module's identity, version number, and COM visibility settings within the larger DTS Viewer application architecture.
|
||||
|
||||
## 2. Public Interface
|
||||
This source file does not contain public classes, methods, or functions. It applies assembly-level attributes that affect the compiled output (`DTS.Viewer.ViewerSettings.dll`).
|
||||
|
||||
The following attributes are defined:
|
||||
|
||||
* **`AssemblyTitle`**: Set to `"DTS.Viewer.ViewerSettings"`.
|
||||
* **`AssemblyDescription`**: Set to an empty string.
|
||||
* **`AssemblyConfiguration`**: Set to an empty string.
|
||||
* **`AssemblyCompany`**: Set to an empty string.
|
||||
* **`AssemblyProduct`**: Set to `"DTS.Viewer.ViewerSettings"`.
|
||||
* **`AssemblyCopyright`**: Set to `"Copyright © 2019"`.
|
||||
* **`AssemblyTrademark`**: Set to an empty string.
|
||||
* **`AssemblyCulture`**: Set to an empty string (indicates the assembly is culture-neutral).
|
||||
* **`ComVisible`**: Set to `false`. This prevents types in this assembly from being visible to COM components.
|
||||
* **`Guid`**: Set to `"4733690a-cb08-4c2e-853a-9339be13ac28"`. This acts as the ID for the type library if the assembly is exposed to COM.
|
||||
* **`AssemblyVersion`**: Set to `"1.0.0.0"`.
|
||||
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`.
|
||||
|
||||
## 3. Invariants
|
||||
* **Version Consistency**: Both `AssemblyVersion` and `AssemblyFileVersion` are currently synchronized at `1.0.0.0`.
|
||||
* **COM Visibility**: The assembly is explicitly non-visible to COM (`ComVisible(false)`). This must be changed at the type level if specific types need COM exposure later.
|
||||
* **Culture Neutrality**: The `AssemblyCulture` attribute is empty, implying this is a neutral/satellite assembly rather than a localized resource assembly.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies**: This file imports `System.Reflection`, `System.Runtime.CompilerServices`, and `System.Runtime.InteropServices`.
|
||||
* **System Context**: This file configures the `DTS.Viewer.ViewerSettings` assembly. Based on the file path, this assembly is part of the `DTS.Viewer.Modules` collection, suggesting it is a submodule consumed by the main `DTS Viewer` application. The specific runtime dependencies of the code within this assembly cannot be determined from this file alone.
|
||||
|
||||
## 5. Gotchas
|
||||
* **SDK-Style Project Compatibility**: If this project is migrated to the modern SDK-style project format (typically .NET Core or .NET 5+), the attributes defined here will conflict with auto-generated assembly information. This would result in build errors (duplicate attributes) unless `<GenerateAssemblyInfo>false</GenerateAssemblyInfo>` is added to the project file.
|
||||
* **Missing Metadata**: `AssemblyDescription`, `AssemblyCompany`, and `AssemblyConfiguration` are empty strings. This missing metadata may appear in file properties dialogs or assembly inspection tools as blank fields.
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
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-16T11:12:19.064013+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 settings UI. It consists of two components: `TranslateExtension`, a WPF `MarkupExtension` that enables XAML bindings to localized strings, and `StringResources`, an auto-generated strongly-typed resource class that wraps a `.resx` file containing the actual localized string values. Together, they allow XAML markup to reference localized strings declaratively (e.g., `{local:Translate SomeKey}`) while centralizing string management through the .NET resource system.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TranslateExtension` (public class)
|
||||
|
||||
**Namespace:** `DTS.Viewer.ViewerSettings`
|
||||
**Base Class:** `System.Windows.Markup.MarkupExtension`
|
||||
**Attribute:** `[MarkupExtensionReturnType(typeof(string))]`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. Stores the key in a readonly field `_key`. |
|
||||
| `ProvideValue` | `public override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key` from `StringResources.ResourceManager`. Returns `NotFound` constant if `_key` is null or empty. Returns `NotFound + " " + _key` if the key is not found in resources. |
|
||||
|
||||
**Constants:**
|
||||
- `private const string NotFound = "#stringnotfound#"` — Fallback value returned when translation cannot be resolved.
|
||||
|
||||
---
|
||||
|
||||
### `StringResources` (internal class)
|
||||
|
||||
**Namespace:** `DTS.Viewer.ViewerSettings.Resources`
|
||||
**Attributes:** `[GeneratedCode]`, `[DebuggerNonUserCode]`, `[CompilerGenerated]`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Lazily-initialized, cached `ResourceManager` instance for the `DTS.Viewer.ViewerSettings.Resources.StringResources` resource bundle. |
|
||||
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Overrides the current thread's `CurrentUICulture` for resource lookups via this class. Can be set to change localization at runtime. |
|
||||
| `CalibrationBehavior_LinearIfAvailable` | `internal static string CalibrationBehavior_LinearIfAvailable { get; }` | Localized string: "Use the linear sensitivity, if available." |
|
||||
| `CalibrationBehavior_NonLinearIfAvailable` | `internal static string CalibrationBehavior_NonLinearIfAvailable { get; }` | Localized string: "Use the non-linear sensitivity, if available." |
|
||||
| `CalibrationBehavior_UseBothIfAvailable` | `internal static string CalibrationBehavior_UseBothIfAvailable { get; }` | Localized string: "Use both sensitivities, if available, as separate channels." |
|
||||
| `CalibrationBehaviorText` | `internal static string CalibrationBehaviorText { get; }` | Localized string: "Calibration Behavior". |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Key immutability:** `_key` in `TranslateExtension` is assigned once in the constructor and is readonly; it cannot be changed after instantiation.
|
||||
|
||||
2. **Non-null return guarantee:** `TranslateExtension.ProvideValue` always returns a non-null `string` — either the localized value, the `NotFound` constant, or `NotFound + " " + _key`.
|
||||
|
||||
3. **ResourceManager singleton pattern:** `StringResources.ResourceManager` is lazily initialized on first access and cached; subsequent accesses return the same instance.
|
||||
|
||||
4. **Thread-safety of ResourceManager initialization:** The getter checks for null using `object.ReferenceEquals(resourceMan, null)` before creating a new `ResourceManager`. **Note:** This pattern is not thread-safe; race conditions could result in multiple `ResourceManager` instances being created.
|
||||
|
||||
5. **Resource key existence:** `StringResources` property getters pass `resourceCulture` (which may be null) to `ResourceManager.GetString`, defaulting to the current thread's `CurrentUICulture` when null.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` — Core .NET types
|
||||
- `System.Windows.Markup` — `MarkupExtension` base class and `MarkupExtensionReturnTypeAttribute`
|
||||
- `System.Resources` — `ResourceManager` for resource lookup
|
||||
- `System.Globalization` — `CultureInfo` for localization
|
||||
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices` — Attributes for generated code (auto-generated dependency)
|
||||
- **External resource file:** `StringResources.resx` (implied by the designer file; not included in source but required at runtime)
|
||||
|
||||
### What depends on this module:
|
||||
- **Cannot be determined from source alone.** The `TranslateExtension` is designed for XAML consumption within the `DTS.Viewer.ViewerSettings` namespace, but no consumers are shown in the provided files.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Different error formats for different failure modes:** A null/empty key returns `"#stringnotfound#"` alone, while a valid but missing key returns `"#stringnotfound# {key}"`. This distinction can be used for debugging but may cause inconsistent UI display if not handled upstream.
|
||||
|
||||
2. **StringResources is internal:** The class is marked `internal`, so it cannot be accessed outside the `DTS.Viewer.ViewerSettings.Resources` namespace's assembly. `TranslateExtension` works around this by accessing `StringResources.ResourceManager` directly.
|
||||
|
||||
3. **Auto-generated file warning:** `StringResources.Designer.cs` is tool-generated. Manual edits will be lost when the `.resx` file is modified and the designer regenerates. The actual string values live in `StringResources.resx`, which is not included in the provided source.
|
||||
|
||||
4. **Thread-safety concern:** The `ResourceManager` property getter uses a non-atomic null check pattern that is not thread-safe. In multi-threaded scenarios, two threads could simultaneously pass the null check and create separate `ResourceManager` instances. While likely harmless in practice (the ResourceManager itself is thread-safe), this violates the singleton intent.
|
||||
|
||||
5. **Culture must be set explicitly on StringResources:** Setting `Thread.CurrentUICulture` will NOT affect `StringResources` lookups if `StringResources.Culture` has been explicitly set to a non-null value. Consumers must either leave `StringResources.Culture` as null (to inherit thread culture) or set it explicitly.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/View/ViewerSettingsView.xaml.cs
|
||||
generated_at: "2026-04-16T11:12:48.949292+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "499d220096c49a25"
|
||||
---
|
||||
|
||||
# Documentation: ViewerSettingsView.xaml.cs
|
||||
|
||||
## 1. Purpose
|
||||
This file defines the code-behind class `ViewerSettingsView` for a WPF `UserControl` within the `DTS.Viewer.ViewerSettings` namespace. It serves as the visual interface component for viewer configuration settings. The class implements the `IViewerSettingsView` interface, suggesting it is part of a larger architectural pattern (likely MVVM) where the view is decoupled from core application logic via the `DTS.Common.Interface` contract.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `ViewerSettingsView`
|
||||
**Inherits from:** Unspecified base class (implicit WPF `UserControl` via `InitializeComponent`).
|
||||
**Implements:** `DTS.Common.Interface.IViewerSettingsView`
|
||||
|
||||
#### Constructor: `ViewerSettingsView()`
|
||||
* **Signature:** `public ViewerSettingsView()`
|
||||
* **Behavior:** Initializes the component. It invokes the standard WPF `InitializeComponent()` method, which loads the XAML markup defined in the associated `.xaml` file for this view.
|
||||
|
||||
## 3. Invariants
|
||||
* **Initialization:** The `InitializeComponent()` method is called exactly once upon instantiation. This is a strict requirement for WPF user controls to correctly parse the XAML and build the visual tree.
|
||||
* **Interface Compliance:** As this class implements `IViewerSettingsView`, it must fulfill any contract defined by that interface (e.g., specific properties or methods), though no explicit interface implementations are visible in this specific source file.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies:**
|
||||
* `DTS.Common.Interface`: Used for the `IViewerSettingsView` interface.
|
||||
* **External Dependencies:**
|
||||
* `System.Windows.Controls`: Used for the base `UserControl` functionality (implied).
|
||||
* Standard WPF namespaces (`System.Windows`, etc.): Referenced for UI elements and logic.
|
||||
* **Associated Files:**
|
||||
* This is a code-behind file; it is inextricably linked to `ViewerSettingsView.xaml`, which contains the actual UI layout.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Missing Interface Implementation Details:** The source file shows the class implements `IViewerSettingsView`, but no explicit implementation of interface members (properties or methods) is present in the code. It is unclear from this source alone whether the interface is empty (a marker interface) or if the implementation is expected to be provided elsewhere (e.g., via XAML bindings or partial class definitions).
|
||||
* **Unused Imports:** The file imports several namespaces (e.g., `System.Linq`, `System.Threading.Tasks`, `System.Windows.Shapes`) that are not utilized in the visible code. This suggests the file may have been generated via a template and not cleaned up, or logic was removed without removing the imports.
|
||||
@@ -0,0 +1,126 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/ViewModel/ViewerSettingsViewModel.cs
|
||||
generated_at: "2026-04-16T11:11:45.719644+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f93455d3d5a535ba"
|
||||
---
|
||||
|
||||
# Documentation: ViewerSettingsViewModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`ViewerSettingsViewModel` is a Prism-based ViewModel responsible for managing viewer configuration settings within the DTS Viewer application. It provides UI binding for calibration behavior selection, handles visibility state for settings panels, and facilitates decoupled communication with other system components via event aggregation. The class serves as the data context for `IViewerSettingsView` and participates in the application's navigation/region management infrastructure.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
|
||||
```csharp
|
||||
public ViewerSettingsViewModel(
|
||||
IViewerSettingsView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the View's DataContext to itself, and creates `NotificationRequest` and `ConfirmationRequest` instances.
|
||||
|
||||
---
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `View` | `IViewerSettingsView` | Gets/sets the associated view interface. |
|
||||
| `Parent` | `IBaseViewModel` | Gets/sets the parent ViewModel, set during initialization with parameter. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notification dialogs. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmation dialogs (declared with `new` keyword). |
|
||||
| `HeaderInfo` | `string` | Returns `"SettingsRegion"`. |
|
||||
| `IsBusy` | `bool` | Busy state indicator (declared with `new` keyword). |
|
||||
| `IsDirty` | `bool` | Dirty state flag (declared with `new` keyword). |
|
||||
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag (declared with `new` keyword). |
|
||||
| `CalibrationBehaviorSettingVisibility` | `Visibility` | Controls visibility of calibration behavior setting UI. Publishes `ViewerSettingsVisibilityChangedEvent` when changed. |
|
||||
| `OverallSettingsVisibility` | `Visibility` | Read-only computed property. Returns `Visibility.Visible` if `CalibrationBehaviorSettingVisibility` is visible; otherwise `Visibility.Collapsed`. |
|
||||
| `AvailableCalibrationBehaviors` | `DisplayedCalibrationBehavior[]` | Lazily-initialized, thread-safe array of three options: `_linearIfAvail`, `_nonLinearIfAvail`, `_useBothIfAvail`. |
|
||||
| `CalibrationBehaviorSetting` | `DisplayedCalibrationBehavior` | Gets/sets the selected calibration behavior. Publishes `CalibrationBehaviorSettingChangedEvent` on change. |
|
||||
|
||||
---
|
||||
|
||||
### Methods
|
||||
|
||||
```csharp
|
||||
public override void Initialize()
|
||||
```
|
||||
Empty override—no behavior.
|
||||
|
||||
```csharp
|
||||
public override void Initialize(object parameter)
|
||||
```
|
||||
Sets `Parent` to the provided parameter (cast to `IBaseViewModel`) and calls `Subscribe()`.
|
||||
|
||||
```csharp
|
||||
public void PublishChanges()
|
||||
```
|
||||
Empty method body—behavior unclear from source.
|
||||
|
||||
---
|
||||
|
||||
### Events
|
||||
|
||||
```csharp
|
||||
public new event PropertyChangedEventHandler PropertyChanged
|
||||
```
|
||||
Declared with `new` keyword, hiding the base class event.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Default Calibration Behavior**: `_calibrationBehaviorSetting` is initialized to `CalibrationBehaviors.NonLinearIfAvailable`.
|
||||
- **Visibility Cascade**: When any property ending in `"Visibility"` (except `"OverallSettingsVisibility"`) changes, `OnPropertyChanged` automatically triggers a notification for `"OverallSettingsVisibility"`.
|
||||
- **Thread Safety**: `AvailableCalibrationBehaviors` uses a lock (`MyLock`) to ensure thread-safe lazy initialization.
|
||||
- **Event Subscription**: `Subscribe()` is called only from `Initialize(object parameter)`, requiring a non-null parameter for event subscriptions to be registered.
|
||||
- **OverallSettingsVisibility Logic**: Always mirrors `CalibrationBehaviorSettingVisibility`—there is no scenario where they differ.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On
|
||||
|
||||
| Namespace | Type(s) Used |
|
||||
|-----------|--------------|
|
||||
| `DTS.Common.Base` | `BaseViewModel<T>` |
|
||||
| `DTS.Common.Classes.Sensors` | `DisplayedCalibrationBehavior` |
|
||||
| `DTS.Common.Enums.Sensors` | `CalibrationBehaviors` |
|
||||
| `DTS.Common.Events` | `CalibrationBehaviorSettingChangedEvent`, `CalibrationBehaviorSettableInViewerChangedEvent`, `ViewerSettingsVisibilityChangedEvent` |
|
||||
| `DTS.Common.Interactivity` | `InteractionRequest<T>`, `Notification`, `Confirmation` |
|
||||
| `DTS.Common.Interface` | `IViewerSettingsViewModel`, `IBaseViewModel`, `IViewerSettingsView` |
|
||||
| `Prism.Events` | `IEventAggregator` |
|
||||
| `Prism.Regions` | `IRegionManager` |
|
||||
| `Unity` | `IUnityContainer` |
|
||||
| `System.Windows` | `Visibility` |
|
||||
| `DTS.Viewer.ViewerSettings.Resources` | `StringResources` (localized display strings) |
|
||||
|
||||
### What Depends On This Module
|
||||
|
||||
Not determinable from source alone—depends on which modules reference `IViewerSettingsViewModel` or instantiate `ViewerSettingsViewModel`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`new` Keyword Hiding**: Multiple members (`PropertyChanged`, `OnPropertyChanged`, `IsBusy`, `IsDirty`, `IsNavigationIncluded`, `ConfirmationRequest`) use the `new` keyword to hide base class members. This breaks polymorphism—if the object is cast to the base type, the base members will be used instead of these overrides.
|
||||
|
||||
2. **Copy-Paste Error in XML Comment**: The constructor's XML documentation references `"TestSummaryViewListModel"`—incorrect for this class.
|
||||
|
||||
3. **Empty `PublishChanges()` Method**: The method has no implementation. Its intended purpose is unclear from source alone.
|
||||
|
||||
4. **Non-Standard Naming Convention**: The private lock object `MyLock` uses PascalCase rather than the conventional underscore-prefix or camelCase pattern used elsewhere in the class.
|
||||
|
||||
5. **Visibility Property Name Convention**: The `OnPropertyChanged` method contains special logic that triggers on any property name ending with `"Visibility"` (except `"OverallSettingsVisibility"`). Adding new visibility properties will have this side effect automatically.
|
||||
|
||||
6. **CalibrationBehaviorSetting Getter Linear Search**: The getter iterates through `AvailableCalibrationBehaviors` on every access to find the matching `DisplayedCalibrationBehavior`. This is O(n) for each get operation.
|
||||
Reference in New Issue
Block a user