init
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Model/ChartOptionsModel.cs
|
||||
generated_at: "2026-04-16T13:57:20.201859+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a2e58408ee52b3f9"
|
||||
---
|
||||
|
||||
# Documentation: ChartOptionsModel.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`ChartOptionsModel` is a state management class for chart configuration options within the DTS Viewer application. It serves as the data model backing chart visualization controls, managing unit types (EU, mV, V, PSD, FFT), time units, axis scaling modes, filter selections, cursor behavior, and zoom/pan state. The class implements `INotifyPropertyChanged` via `BasePropertyChanged` to support MVVM data binding and coordinates with a parent `IChartOptionsViewModel` to publish configuration changes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `DisplayingVolts` | `bool` | get/set | Controls whether voltage displays as "V" (true) or "mV" (false). Raises `OnPropertyChanged` for `"MVOrV"` and `"UnitTypeDescription"` when changed. |
|
||||
| `MVOrV` | `string` | get | Returns `"V"` if `DisplayingVolts` is true, otherwise `"mV"`. |
|
||||
| `IsDigitalChannel` | `bool` | get/set | Indicates whether the current channel is digital. |
|
||||
| `SupportsADC` | `bool` | get/set | Indicates ADC support for the current context. |
|
||||
| `SupportsMV` | `bool` | get/set | Indicates mV unit support. |
|
||||
| `UnitType` | `ChartUnitTypeEnum` | get/set | The current unit type (EU, mV, PSD, FFT, etc.). Changing this sets `ReadData = true` and auto-adjusts `Filter`. |
|
||||
| `UnitTypeDescription` | `string` | get | Returns the display string for `UnitType`. Returns `"V"` or `"mV"` when `UnitType == ChartUnitTypeEnum.mV`. |
|
||||
| `TimeUnitType` | `TimeUnitTypeEnum` | get/set | Time axis unit. Defaults to `TimeUnitTypeEnum.MS`. Changing sets `ReadData = true`. |
|
||||
| `TimeUnitTypeDescription` | `string` | get/set | String representation of `TimeUnitType`. |
|
||||
| `SelectedFilter` | `IFilterClass` | get/set | Currently selected filter class. Changing sets `ReadData = true`. |
|
||||
| `MinFixedY` | `double` | get/set | Minimum Y-axis value for fixed scaling. |
|
||||
| `MaxFixedY` | `double` | get/set | Maximum Y-axis value for fixed scaling. |
|
||||
| `MinFixedT` | `double` | get/set | Minimum T (time) axis value for fixed scaling. |
|
||||
| `MaxFixedT` | `double` | get/set | Maximum T (time) axis value for fixed scaling. |
|
||||
| `FullScaleValues` | `List<double>` | get/set | Returns `_euValues` if `UnitType` is `EU` or `PSD`, otherwise `_fullScaleValues`. |
|
||||
| `SelectedFullScaleValue` | `double` | get/set | Currently selected full-scale value. Defaults to `100`. |
|
||||
| `LockedT` | `bool` | get/set | Whether the time axis is locked. |
|
||||
| `LockedY` | `bool` | get/set | Whether the Y-axis is locked. |
|
||||
| `ShowCursor` | `bool` | get/set | Cursor visibility. Setter calls `Parent?.ShowCusor(value)`. |
|
||||
| `CurrentCursorValues` | `string` | get/set | Current cursor values display string. |
|
||||
| `YRange` | `YRangeScaleEnum` | get/set | Y-axis range mode. Setting to `Fixed` automatically sets `LockedY = true`. |
|
||||
| `Filter` | `FilterOptionEnum` | get/set | Filter option enum. Changing sets `ReadData = true`. |
|
||||
| `Parent` | `IChartOptionsViewModel` | get/set | Parent view model reference. |
|
||||
| `CanPublishChanges` | `bool` | get/set | Controls whether property changes trigger `Parent.PublishChanges()`. Defaults to `true`. |
|
||||
| `IsCursorsAvailable` | `bool` | get/set | Whether cursors are available for the current context. |
|
||||
| `T0Cursor` | `bool` | get/set | T0 cursor flag. |
|
||||
| `MinMaxCursors` | `bool` | get/set | Min/Max cursors flag. |
|
||||
| `ReadData` | `bool` | get/set | Flag indicating data should be re-read. |
|
||||
| `IsSaved` | `bool` | get | Saved status (setter not visible in source). |
|
||||
| `DecimateData` | `bool` | get/set | Getter returns `false` if `UnitType` is `PSD` or `FFT`, otherwise returns backing field value. |
|
||||
| `WidthPoints` | `long` | get/set | Width points for decimation. |
|
||||
|
||||
### Commands
|
||||
|
||||
| Command | Type | Description |
|
||||
|---------|------|-------------|
|
||||
| `ResetZoomCommand` | `DelegateCommand` | Executes `ResetZoomMethod()`, which delegates to `Parent.ResetZoomMethod()`. |
|
||||
| `ResetTCommand` | `DelegateCommand` | Executes `ResetTMethod()`, which delegates to `Parent.ResetTMethod()`. |
|
||||
| `SaveToPDFCommand` | `DelegateCommand` | Executes `SaveToPDFMethod()`, which delegates to `Parent.SaveToPDFMethod()`. |
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ChartOptionsModel` | `public ChartOptionsModel()` | Empty constructor. |
|
||||
| `SetSelectedFilterToUnfilteredNoRead` | `public void SetSelectedFilterToUnfilteredNoRead()` | Sets `SelectedFilter` to unfiltered without setting `ReadData = true`. |
|
||||
| `OnPropertyChanged` | `public void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event and conditionally calls `Parent?.PublishChanges()`. |
|
||||
|
||||
### Events
|
||||
|
||||
| Event | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `PropertyChanged` | `PropertyChangedEventHandler` | Standard INotifyPropertyChanged event. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **UnitType → Filter coupling**: When `UnitType` is set to anything other than `EU` or `PSD`, `Filter` is automatically set to `FilterOptionEnum.Unfiltered`. When set to `EU` or `PSD`, `Filter` is set to `FilterOptionEnum.TestSetupDefault`.
|
||||
|
||||
2. **YRange → LockedY coupling**: Setting `YRange` to `YRangeScaleEnum.Fixed` automatically sets `LockedY = true`.
|
||||
|
||||
3. **DecimateData PSD/FFT exclusion**: `DecimateData` getter always returns `false` when `UnitType` is `ChartUnitTypeEnum.PSD` or `ChartUnitTypeEnum.FFT`, regardless of the backing field value.
|
||||
|
||||
4. **FullScaleValues selection**: The property returns `_euValues` (5000, 2500, 1000, 500, 100, 50, 10, 5) for `EU` or `PSD` unit types, and `_fullScaleValues` (200, 100, 50, 20, 10, 5, 1, 0.1) otherwise.
|
||||
|
||||
5. **ReadData side effects**: Setting `UnitType`, `TimeUnitType`, `SelectedFilter`, or `Filter` automatically sets `ReadData = true`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common` — Common utilities
|
||||
- `DTS.Common.Classes.Sensors` — `FilterClass` implementation
|
||||
- `DTS.Common.Enums.Viewer` — `ChartUnitTypeEnum`, `TimeUnitTypeEnum`, `FilterOptionEnum`, `YRangeScaleEnum`
|
||||
- `DTS.Common.Interface` — `IChartOptionsModel` interface
|
||||
- `DTS.Common.Interface.Sensors.SoftwareFilters` — `IFilterClass` interface
|
||||
- `Prism.Commands` — `DelegateCommand` for MVVM commands
|
||||
- `Common.Base.BasePropertyChanged` — Base class providing `SetProperty` method for INotifyPropertyChanged implementation
|
||||
|
||||
### What depends on this module:
|
||||
- `IChartOptionsViewModel` implementations (referenced as `Parent` property)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Typo in method call**: In `ShowCursor` setter, the code calls `Parent?.ShowCusor(_showCursor)` — note the misspelling "Cusor" instead of "Cursor". This may cause confusion when searching for the method definition.
|
||||
|
||||
2. **Conditional PublishChanges suppression**: The `OnPropertyChanged` method explicitly skips calling `Parent?.PublishChanges()` for specific property names: `"CanPublishChanges"`, `"Parent"`, `"ReadData"`, `"UnitTypeDescription"`, `"ShowCursor"`, `"LockedT"`, `"LockedY"`, `"MVOrV"`, `"DisplayingVolts"`, `"DecimateData"`, `"WidthPoints"`. This is not documented elsewhere and could lead to unexpected behavior.
|
||||
|
||||
3. **IsSaved property has no visible implementation**: The property has only a getter with no backing field or setter visible in the source. Its behavior is unclear from this file alone.
|
||||
|
||||
4. **SetSelectedFilterToUnfilteredNoRead bypasses normal flow**: This method directly sets the backing field `_selectedFilter` and sets `ReadData = false`, bypassing the normal property setter which would set `ReadData = true`.
|
||||
|
||||
5. **Inconsistent property change patterns**: Some properties use `SetProperty(ref _field, value, "PropertyName")` while others manually check equality and call `OnPropertyChanged`. This inconsistency may indicate incremental development over time.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T13:56:36.683530+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fddf8c3b00b320fd"
|
||||
---
|
||||
|
||||
# Documentation for AssemblyInfo.cs
|
||||
|
||||
## 1. Purpose
|
||||
This source file provides assembly-level metadata configuration for the `DTS.Viewer.ChartOptions` module. It exists to embed standard identifying information—such as title, version, and copyright—into the compiled assembly manifest. Its role is strictly limited to build-time configuration; it contains no executable application logic.
|
||||
|
||||
## 2. Public Interface
|
||||
This file does not expose any public classes, methods, or functions. It applies the following assembly-level attributes:
|
||||
|
||||
* **`AssemblyTitle`**: Set to `"DTS.Viewer.DTS.Viewer.ChartOptions"`.
|
||||
* **`AssemblyDescription`**: Empty.
|
||||
* **`AssemblyConfiguration`**: Empty.
|
||||
* **`AssemblyCompany`**: Empty.
|
||||
* **`AssemblyProduct`**: Set to `"DTS.Viewer.DTS.Viewer.ChartOptions"`.
|
||||
* **`AssemblyCopyright`**: Set to `"Copyright © 2017"`.
|
||||
* **`AssemblyTrademark`**: Empty.
|
||||
* **`AssemblyCulture`**: Empty.
|
||||
* **`ComVisible`**: Set to `false`. Prevents types within this assembly from being visible to COM components by default.
|
||||
* **`Guid`**: Set to `"9f161f2a-4fcd-438e-9768-ba96ba104d6c"`. Serves 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
|
||||
* **COM Visibility**: The assembly is explicitly marked with `ComVisible(false)`. Therefore, all types within this assembly are invisible to COM by default unless a specific type is marked otherwise.
|
||||
* **Versioning**: Both the assembly version and file version are fixed at `1.0.0.0`. Automatic versioning (e.g., using wildcards) is currently disabled/commented out.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies**:
|
||||
* `System.Reflection`
|
||||
* `System.Runtime.CompilerServices`
|
||||
* `System.Runtime.InteropServices`
|
||||
* **External Consumers**: The compiled `DTS.Viewer.ChartOptions` assembly depends on this file for its manifest metadata. The build system consumes this file during compilation.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Naming Redundancy**: The `AssemblyTitle` and `AssemblyProduct` attributes are set to `"DTS.Viewer.DTS.Viewer.ChartOptions"`. This appears to duplicate the root namespace (`DTS.Viewer`) within the name, which may be a project naming convention or a configuration oversight.
|
||||
* **Legacy Format**: This file uses the older .NET Framework style of `AssemblyInfo.cs`. In modern .NET Core/.NET 5+ projects (SDK-style projects), this metadata is typically defined in the project file (`.csproj`), though this file is still supported.
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/TranslateExtension.cs
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T13:56:16.461808+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8d340ea94a701586"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.ChartOptions Resources
|
||||
|
||||
## 1. Purpose
|
||||
This module provides localization infrastructure for the `DTS.Viewer.ChartOptions` 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. This separates user-facing string management from application logic, supporting multi-language scenarios.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TranslateExtension` (Class)
|
||||
**Namespace:** `DTS.Viewer.ChartOptions`
|
||||
**Inheritance:** `System.Windows.Markup.MarkupExtension`
|
||||
|
||||
This class enables XAML binding to localized resources.
|
||||
|
||||
* **Constructor**
|
||||
* `public TranslateExtension(string key)`: Initializes the extension with the resource key to look up.
|
||||
|
||||
* **Methods**
|
||||
* `public override object ProvideValue(IServiceProvider serviceProvider)`: Resolves the `_key` provided in the constructor to a localized string.
|
||||
* Returns the localized string if found.
|
||||
* Returns `#stringnotfound#` if the key is null or empty.
|
||||
* Returns `#stringnotfound# [key]` if the lookup fails for a specific key.
|
||||
|
||||
### `StringResources` (Class)
|
||||
**Namespace:** `DTS.Viewer.ChartOptions.Resources`
|
||||
**Access Modifier:** `internal`
|
||||
|
||||
A strongly-typed resource class auto-generated by Visual Studio. It provides static properties to access culture-specific string values.
|
||||
|
||||
* **Properties**
|
||||
* `internal static global::System.Resources.ResourceManager ResourceManager`: Gets the cached `ResourceManager` instance for this assembly.
|
||||
* `internal static global::System.Globalization.CultureInfo Culture`: Gets or sets the current UI culture used for resource lookups.
|
||||
|
||||
* **Resource String Properties (Static, Read-Only)**
|
||||
The following properties return localized strings corresponding to specific UI elements:
|
||||
* `ChartUnitType`
|
||||
* `FilterOptions_Title`
|
||||
* `LockT`
|
||||
* `MaxT`
|
||||
* `MaxY`
|
||||
* `MinT`
|
||||
* `MinY`
|
||||
* `Range`
|
||||
* `ResetAll`
|
||||
* `ResetT`
|
||||
* `SaveChart`
|
||||
* `SaveToPDF`
|
||||
* `TimeUnitType`
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Return Type Guarantee:** The `TranslateExtension` class is decorated with `[MarkupExtensionReturnType(typeof(string))]`, guaranteeing that `ProvideValue` returns a `string` (boxed as `object`).
|
||||
2. **Non-Null Return:** `TranslateExtension.ProvideValue` will never return `null`. It guarantees a return value even if the key is missing or invalid (returning a fallback error string).
|
||||
3. **Resource Manager Singleton:** `StringResources.ResourceManager` uses a lazy-initialization pattern; it creates the `ResourceManager` instance only once and caches it in the private static field `resourceMan`.
|
||||
4. **Immutability of Key:** Once `TranslateExtension` is constructed, the `_key` field is `readonly` and cannot be changed.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**Internal Dependencies:**
|
||||
* `TranslateExtension` depends entirely on `StringResources.ResourceManager` to perform the actual string lookup.
|
||||
|
||||
**External Dependencies:**
|
||||
* `System.Windows.Markup`: Required for `MarkupExtension` and `IServiceProvider` (implies this is a WPF module).
|
||||
* `System.Resources`: Required for `ResourceManager`.
|
||||
* `System.Globalization`: Required for `CultureInfo`.
|
||||
|
||||
**Downstream Dependencies:**
|
||||
* XAML files within the `DTS.Viewer.ChartOptions` module (or other modules referencing this namespace) depend on `TranslateExtension` to display localized text (e.g., usage likely looks like `{local:Translate KeyName}`).
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Silent Failure Behavior:** `TranslateExtension` does not throw exceptions for missing keys. Instead, it returns the literal string `#stringnotfound#` (for null/empty keys) or `#stringnotfound# [key]` (for missing keys). This visual indicator might appear in the UI if resources are misconfigured, rather than causing a compile-time or runtime crash.
|
||||
2. **Auto-Generated Code:** `StringResources` is marked with `GeneratedCodeAttribute`. Manual edits to this file will be overwritten if the resource tooling regenerates it. The actual string values reside in an external `.resx` file (likely `StringResources.resx`) which is not visible in the provided source but is implied by the designer file.
|
||||
3. **Internal Visibility:** The `StringResources` class is `internal`. It cannot be accessed directly from outside the `DTS.Viewer.ChartOptions` assembly. However, `TranslateExtension` is `public`, allowing external assemblies to use the XAML extension if they reference this assembly.
|
||||
4. **Case Sensitivity:** The `ResourceManager.GetString` method called by `TranslateExtension` is typically case-sensitive regarding the resource key (depending on the underlying resource set implementation), though the constant `_key` is passed exactly as provided to the constructor.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/View/ChartOptionsView.xaml.cs
|
||||
generated_at: "2026-04-16T13:56:57.437477+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2fdf05f68ae69d8d"
|
||||
---
|
||||
|
||||
# Documentation: ChartOptionsView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`ChartOptionsView` is a WPF view component that provides user interface logic for configuring chart display options. It implements the `IChartOptionsView` interface, serving as the visual layer for chart-related settings within the DTS Viewer application. The view exposes available filter class options that can be applied to sensor data visualization.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ChartOptionsView()` (Constructor)
|
||||
**Signature:** `public ChartOptionsView()`
|
||||
|
||||
Initializes a new instance of the `ChartOptionsView` class. Calls `InitializeComponent()` to load the associated XAML layout.
|
||||
|
||||
---
|
||||
|
||||
### `AvailableCFC` (Property)
|
||||
**Signature:** `public List<IFilterClass> AvailableCFC { get; }`
|
||||
|
||||
A read-only property that returns the list of available filter classes (CFC = Constant Fraction Classes, per FB 13120).
|
||||
|
||||
**Behavior:** Each access instantiates a new `AnalogSettingDefaults` object and returns its `FilterOptions` property.
|
||||
|
||||
**Returns:** `List<IFilterClass>` containing the available filter options.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The `AvailableCFC` property getter always creates a **new instance** of `AnalogSettingDefaults` on every access; it does not cache or reuse the object.
|
||||
- The view always implements `IChartOptionsView` as its contract with the rest of the system.
|
||||
- The XAML component (referenced via `InitializeComponent()`) is expected to be present and properly compiled as part of the partial class definition.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
| Namespace | Type Used |
|
||||
|-----------|-----------|
|
||||
| `DTS.Common.Interface` | `IChartOptionsView` |
|
||||
| `DTS.Common.Interface.Sensors.SoftwareFilters` | `IFilterClass` |
|
||||
| `DTS.SensorDB` | `AnalogSettingDefaults` |
|
||||
|
||||
### What depends on this module:
|
||||
**Unclear from source alone.** The `IChartOptionsView` interface suggests a presenter, view model, or controller consumes this view, but no direct consumers are visible in this file.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Instance creation on every property access:** The `AvailableCFC` property instantiates a new `AnalogSettingDefaults` object on every call. If this property is data-bound in XAML and accessed frequently (e.g., by a UI update loop), it could create unnecessary object allocations and GC pressure. Consider whether caching would be appropriate.
|
||||
|
||||
2. **FB 13120 reference:** The XML comment references "FB 13120" (likely a feature/bug tracking identifier). The business context for why this property exists or what specific requirement it addresses is not clear from source alone.
|
||||
|
||||
3. **Partial class definition:** This is a partial class. The XAML file (`ChartOptionsView.xaml`) defines additional structure (base class, visual elements) that is not visible here. The actual base class (likely `UserControl` or similar) is defined in the XAML.
|
||||
@@ -0,0 +1,124 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/ViewModel/ChartOptionsViewModel.cs
|
||||
generated_at: "2026-04-16T13:55:59.501828+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7f2f2e90f6f17587"
|
||||
---
|
||||
|
||||
# Documentation: ChartOptionsViewModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`ChartOptionsViewModel` is a Prism-based ViewModel that manages chart configuration options for the DTS Viewer application. It serves as an intermediary between chart views and the event system, handling axis range settings, unit type selection (EU, mV, ADC), cursor visibility controls, and publishing chart option changes to other application components. The module supports multiple parent contexts including `IViewerMainViewModel` and `IPSDReportMainViewModel`, with different initialization behaviors for each.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
```csharp
|
||||
public ChartOptionsViewModel(
|
||||
IChartOptionsView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets up interaction requests, and subscribes to `ChartAxisChangedEvent`.
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Parent` | `IBaseViewModel` | Reference to the parent ViewModel. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Prism interaction request for notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Prism interaction request for confirmations. |
|
||||
| `View` | `IBaseView` | Associated view instance. |
|
||||
| `Model` | `IChartOptionsModel` | The chart options model; setter triggers `OnPropertyChanged("Model")`. |
|
||||
| `ContextSearchRegion` | `object` | Region context for search functionality. |
|
||||
| `IsMenuIncluded` | `bool` | Hides base member; menu inclusion flag. |
|
||||
| `IsNavigationIncluded` | `bool` | Hides base member; navigation inclusion flag. |
|
||||
| `IsBusy` | `bool` | Hides base member; busy state indicator. |
|
||||
| `IsDirty` | `bool` | Hides base member; dirty state (get-only). |
|
||||
| `ChartOptionsVisability` | `bool` | Controls visibility of chart options UI; defaults to `false`. |
|
||||
| `ClearMarkersCommand` | `DelegateCommand` | Command that invokes `ClearMarkersMethod()`. |
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `override void Initialize()` | Empty override; no implementation. |
|
||||
| `Initialize` | `override void Initialize(object parameter)` | Main initialization accepting `IViewerMainViewModel` or `Tuple<IBaseViewModel, string>` containing `IPSDReportMainViewModel`. Sets up model, subscriptions, and configures based on parameter type. |
|
||||
| `ShowMinMaxCursor` | `void ShowMinMaxCursor(bool value)` | Publishes `CursorShowMinMaxChangedEvent` with the boolean value. |
|
||||
| `ResetZoomMethod` | `void ResetZoomMethod()` | Sets `Model.YRange` to `AutoRange` and publishes `ResetZoomChangedEvent(true)`. |
|
||||
| `ResetTMethod` | `void ResetTMethod()` | Publishes `ResetZoomChangedEvent(false)`. |
|
||||
| `SaveToPDFMethod` | `void SaveToPDFMethod()` | Publishes `SaveToPDFRequestedEvent` with the `Directory` path. |
|
||||
| `PublishChanges` | `void PublishChanges()` | Publishes `ChartOptionsChangedEvent` with `ChartOptionsChangedEventArg` containing `ParentVM`, `Model`, and `ChartType`. |
|
||||
| `ShowCusor` | `void ShowCusor(bool value)` | Publishes `CursorShowChangedEvent` with the boolean value. |
|
||||
| `OnPropertyChanged` | `new void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Model Resolution**: `Model` must be resolved via `_unityContainer.Resolve<IChartOptionsModel>()` before use; it is not resolved in the constructor but in `Initialize(object parameter)`.
|
||||
|
||||
2. **Parent Matching for Events**: Event handlers (`OnChartAxisChangedEvent`, `OnGraphSelectedChannelsChanged`) check `args?.ParentVM != Parent` and return early if the event is not intended for this instance.
|
||||
|
||||
3. **Publish Control**: `Model.CanPublishChanges` must be `true` for changes to propagate via `PublishChanges()`. It is set to `false` during batch configuration updates.
|
||||
|
||||
4. **Unit Type Fallback**: If channels do not support ADC or mV (determined by `AllChannelsSupportADC` / `AllChannelsSupportmV`), the `UnitType` falls back to `ChartUnitTypeEnum.EU`.
|
||||
|
||||
5. **ADC/mV Support Detection**: Both `AllChannelsSupportADC` and `AllChannelsSupportmV` return `false` if any channel's parent module has a TSR AIR serial number (checked via `HardwareConstants.IsTSRAIRSerialNumber`).
|
||||
|
||||
6. **Graph Chart Type Constraints**: When `chartType == "Graph"`, the model is configured with:
|
||||
- `UnitType = ChartUnitTypeEnum.PSD`
|
||||
- `YRange = YRangeScaleEnum.Fixed`
|
||||
- `MaxFixedY = 1`
|
||||
- `MinFixedY = 1e-12` (non-zero for log scale)
|
||||
- `DecimateData = false`
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `DTS.Common.Base` - `BaseViewModel<IChartOptionsViewModel>`
|
||||
- `DTS.Common.Enums.Viewer` - `ChartUnitTypeEnum`, `YRangeScaleEnum`, `FilterOptionEnum`
|
||||
- `DTS.Common.Events` - `ChartAxisChangedEvent`, `CursorsAlailableChangedEvent`, `GraphSelectedChannelsNotification`, `CursorShowMinMaxChangedEvent`, `ResetZoomChangedEvent`, `SaveToPDFRequestedEvent`, `ChartOptionsChangedEvent`, `CursorShowChangedEvent`, `CursorsClearChangedEvent`
|
||||
- `DTS.Common.Interface` - `IChartOptionsViewModel`, `IChartOptionsModel`, `IChartOptionsView`, `IBaseViewModel`, `IBaseView`, `IViewerMainViewModel`, `IPSDReportMainViewModel`, `ITestChannel`
|
||||
- `DTS.Common.Interactivity` - Interaction requests
|
||||
- `DTS.Common.Enums.Hardware` - `HardwareConstants.IsTSRAIRSerialNumber()`
|
||||
- `Prism.Events` - `IEventAggregator`
|
||||
- `Prism.Regions` - `IRegionManager`
|
||||
- `Prism.Commands` - `DelegateCommand`
|
||||
- `Unity` - `IUnityContainer`
|
||||
|
||||
### What Depends On This Module:
|
||||
- Not explicitly shown in source; inferred consumers include:
|
||||
- `IChartOptionsView` implementations
|
||||
- `IViewerMainViewModel` implementations
|
||||
- `IPSDReportMainViewModel` implementations
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Misleading XML Documentation**: The constructor's XML comment references `TestSummaryViewModel` instead of `ChartOptionsViewModel` — appears to be copy-paste tech debt.
|
||||
|
||||
2. **`new` Keyword Hiding**: Multiple members (`IsMenuIncluded`, `IsNavigationIncluded`, `IsBusy`, `IsDirty`, `ConfirmationRequest`, `Model`, `PropertyChanged`, `OnPropertyChanged`) use the `new` keyword to hide base class members. This can cause unexpected behavior when casting to base types.
|
||||
|
||||
3. **Typo in Property Name**: `ChartOptionsVisability` should be `ChartOptionsVisibility`.
|
||||
|
||||
4. **Typo in Method Name**: `ShowCusor` should be `ShowCursor`.
|
||||
|
||||
5. **Typo in Event Handler**: `OnCursorsAlailableChanged` and `CursorsAlailableChangedEvent` misspell "Available" as "Alailable".
|
||||
|
||||
6. **Identical ADC/mV Logic**: `AllChannelsSupportADC` and `AllChannelsSupportmV` have identical implementations. The comment in `AllChannelsSupportADC` suggests this may be placeholder logic based on serial numbers, with future sophistication planned.
|
||||
|
||||
7. **Unused/Private Fields**: Several ReSharper suppressions (`UnassignedGetOnlyAutoProperty`, `NotAccessedField.Local`, `UnusedAutoPropertyAccessor.Local`) suggest dead code or incomplete implementations.
|
||||
|
||||
8. **Commented-Out Constructor Code**: Lines resolving and assigning `Model` in the constructor are commented out, suggesting initialization was moved to `Initialize(object parameter)`.
|
||||
|
||||
9. **Directory Property Purpose Unclear**: The `Directory` property is set from the first selected channel's `BinaryFilePath` and used only in `SaveToPDFMethod()`. The relationship between chart options and this directory is not documented.
|
||||
Reference in New Issue
Block a user