init
This commit is contained in:
@@ -0,0 +1,311 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/Constants.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegFlex.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegPLI.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/PedestrianReportTab.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/PedestrianSetupTab.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegARSReport.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/ReportProperty.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/ExportBase.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/UprLegReport.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegFlexReport.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/HeadReport.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LwrLegTRLReport.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/GraphChannel.cs
|
||||
generated_at: "2026-04-16T04:54:22.761170+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "13034354ad605201"
|
||||
---
|
||||
|
||||
# Pedestrian and Head Reports Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides report generation and visualization infrastructure for pedestrian and head impact testing within the DataPRO system. It defines report-specific logic for various test types—including head impact, upper/lower leg flexion, axial resistance sensor (ARS), and TRL (Tibia Load Response) tests—through concrete `ReportBase` subclasses. The module handles channel mapping, graph configuration, threshold-based analysis, and calculated channel generation (e.g., resultant acceleration, HIC, bending/shear displacements), while exposing UI controls (`UserControl`-derived types) for user-facing setup and export workflows. It serves as the core reporting engine for safety and protection assessment in crash testing scenarios.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constants and Enums (`ConstantsAndEnums`)
|
||||
|
||||
- **`HEAD_X_ID`, `HEAD_Y_ID`, `HEAD_Z_ID`**
|
||||
`public const string`
|
||||
Channel identifiers for X, Y, and Z-axis acceleration in head reports: `"X軸加速度"`, `"Y軸加速度"`, `"Z軸加速度"`.
|
||||
|
||||
- **`HeadImpactorTypes`**
|
||||
`public enum`
|
||||
Defines impactor types: `ADULT`, `CHILD`.
|
||||
|
||||
- **`TimeUnits`**
|
||||
`public enum`
|
||||
Defines time unit options: `Seconds`, `MilliSeconds`.
|
||||
|
||||
### Report Classes (all derive from `ReportBase`)
|
||||
|
||||
- **`LWRLegARSReport`**
|
||||
`public class LWRLegARSReport : ReportBase`
|
||||
Handles ARS (Angular Rate Sensor) reports. Defines channels: `ARSXAxial`, `ARSYAxial`, `ARSZAxial`, `ARSXAccel`. Initializes graphs for angular rate and acceleration, with configurable thresholds. Sets `ImpactorType` to `"ARS"` and `FrequencyClass` to `CFC180`.
|
||||
|
||||
- **`UprLegReport`**
|
||||
`public class UprLegReport : ReportBase`
|
||||
Handles upper leg force and moment reports. Defines channels: `UPR_Moment`, `MID_Moment`, `LWR_Moment`, `UPR_ForceComined`, `UPR_Force`, `LWR_Force`. Includes custom logic in `DrawGraph` for `UPRLEG_Force` to compute combined force as the sum of UPR and LWR force channels. Sets `ImpactorType` to `"UPR LEG"` and `FrequencyClass` to `CFC180`.
|
||||
|
||||
- **`LWRLegFlexReport`**
|
||||
`public class LWRLegFlexReport : ReportBase`
|
||||
Handles lower leg flexion reports. Defines channels for femur, tibia, and ligaments (ACL, PCL, MCL, LCL). Supports two test types: `"Penduram"` and `"Inverse"` (via `FlexType` property). Initializes multiple graphs (e.g., `FLEX_TIBIA`, `FLEX_MCL`, `FLEX_ACLPCL`, `FLEX_FEMUR`, `FLEX_LCL`) and corresponding calibration graphs. Sets `ImpactorType` to `"FLEX"` and `FrequencyClass` to `CFC180`.
|
||||
|
||||
- **`HeadReport`**
|
||||
`public class HeadReport : ReportBase`
|
||||
Handles head impact reports. Defines channels: `HEAD_X`, `HEAD_Y`, `HEAD_Z`, `HEAD_DISPLACEMENT`, `HEAD_RESULTANT`. Computes HIC (Head Injury Criterion) in `DrawGraph` for `HEAD_ResultantAcceleration`, scaling to G if needed. Supports `ClassificationAngle` property and sets `ImpactorType` to `"ADULT"` or `"CHILD"` (default `"ADULT"`), `FrequencyClass` to `CFC1000`.
|
||||
|
||||
- **`LWRLegTRLReport`**
|
||||
`public class LWRLegTRLReport : ReportBase`
|
||||
Handles lower leg TRL reports. Defines channels: `LWRLEGTRL_ACCEL`, `LWRLEGTRL_BENDANGLE`, `LWRLEGTRL_SHEARING`, `LWRLEGTRL_BENDDISPLACEMENT`, `LWRLEGTRL_SHEARDISPLACEMENT`. Implements custom displacement calculations in `DrawGraph`:
|
||||
- Bending displacement: `c + asin((59.5/43.5) * sin(c))` (angle in degrees, output in mm).
|
||||
- Shear displacement: `27.5 * sin(c)` (angle in degrees, output in mm).
|
||||
Sets `ImpactorType` to `"E-PLI"` and `FrequencyClass` to `CFC180`.
|
||||
|
||||
### UI Controls
|
||||
|
||||
- **`LWRLegFlex`**
|
||||
`public partial class LWRLegFlex : UserControl`
|
||||
UI control for lower leg flexion report setup. Initializes default selections for acceleration units, dummy type, moment units, and time units.
|
||||
|
||||
- **`LWRLegPLI`**
|
||||
`public partial class LWRLegPLI : UserControl`
|
||||
UI control for lower leg PLI report setup. Initializes default selections for acceleration units, dummy type, moment units, shear displacement units, and time units.
|
||||
|
||||
- **`PedestrianReportTab`**
|
||||
`public partial class PedestrianReportTab : C1.Win.C1Command.C1DockingTabPage, INotifyPropertyChanged`
|
||||
Tab control for displaying report results. Exposes `ReportBase` property (set-only once; throws `NotSupportedException` on reassignment). Implements `INotifyPropertyChanged` for UI binding.
|
||||
|
||||
- **`PedestrianSetupTab`**
|
||||
`public partial class PedestrianSetupTab : C1.Win.C1Command.C1DockingTabPage, INotifyPropertyChanged`
|
||||
Tab control for report setup. Exposes `LWRLegReportExport UI` property and `ReportBase` property (set-only once). Notifies UI of property changes via `UI.PropertyChanged(...)`.
|
||||
|
||||
### Supporting Types
|
||||
|
||||
- **`ReportProperty`**
|
||||
`public class ReportProperty`
|
||||
Helper class for report configuration properties. Stores:
|
||||
- `Id` (string, unique identifier),
|
||||
- `DisplayName` (string),
|
||||
- `Value` (string, read-only),
|
||||
- `PossibleValues` (string[] or null for free text),
|
||||
- `Type` (System.Type, native type of value).
|
||||
Used to populate UI controls (e.g., dropdowns) and serialize report setups.
|
||||
|
||||
- **`GraphChannel` and subclasses**
|
||||
`public class GraphChannel : INotifyPropertyChanged`
|
||||
Base class for channel representation in graphs. Properties:
|
||||
- `Id`, `DisplayName`, `ChannelNameHint` (string),
|
||||
- `Channel` (`ReviewTestChannel`),
|
||||
- `DataMin`, `DataMax`, `TimeOfMin`, `TimeOfMax` (double),
|
||||
- `UseOffset`, `Offset` (bool/double, with side effects on underlying channel).
|
||||
Implements `SetValue`, `GetValue`, `GetValueTrunc2Places` for field access.
|
||||
|
||||
Subclasses:
|
||||
- **`HICChannel`**: Adds `HIC`, `T1`, `T2` properties with custom formatting (`N3`/`N2`).
|
||||
- **`VectorAddition`**: Placeholder for vector-summed channels (e.g., combined force).
|
||||
- **`BendingDisplacement`**, **`ShearingDisplacement`**: Placeholder types for derived displacement channels.
|
||||
|
||||
### Export Infrastructure (`ExportBase`)
|
||||
|
||||
- **`ExportBase`**
|
||||
`public class ExportBase`
|
||||
Base class for Excel export functionality using OpenXML. Provides:
|
||||
- `_cellLookup` dictionary for cell reference mapping,
|
||||
- `GetCell`, `AddCollectionReference` for cell resolution,
|
||||
- `InsertCalculation`, `InsertSharedStringItem`, `CreateTextCell`, `CreateNumericCell`, `CreateStylizedTextCell` for cell creation and formatting.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`ReportBase.ReportBase` assignment is single-write**:
|
||||
Both `PedestrianReportTab.ReportBase` and `PedestrianSetupTab.ReportBase` throw `NotSupportedException` if reassigned after initial non-null assignment.
|
||||
|
||||
- **Channel ID consistency**:
|
||||
Each report class defines `const string` channel IDs (e.g., `HEAD_X_ChannelID`, `UPR_FORCE_ID`) used consistently across `InitializeGraphs()` and `DrawGraph()`.
|
||||
|
||||
- **Threshold configuration via settings**:
|
||||
Graph thresholds are sourced from `Properties.Settings.Default.PROTECTIONREPORT_*` (e.g., `PROTECTIONREPORT_HEADACCEL_Threshold`). No hardcoded thresholds.
|
||||
|
||||
- **Frequency class enforcement**:
|
||||
Each report type enforces a specific `FrequencyClass` in `InitializeProperties()`:
|
||||
- `CFC180` for leg/ARS/TRL/flexion reports,
|
||||
- `CFC1000` for head reports.
|
||||
|
||||
- **Unit scaling for head reports**:
|
||||
In `HeadReport.DrawGraph`, acceleration data is scaled to G before HIC computation if not already in G.
|
||||
|
||||
- **`DrawGraph` reentrancy guard**:
|
||||
`UprLegReport.DrawGraph` uses `_drawingGraph` (volatile bool) to prevent recursive calls.
|
||||
|
||||
- **`ReportProperty.Value` is immutable after `SetValue`**:
|
||||
`ReportProperty.Value` has no public setter; value is set only via `SetValue(string)`.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies
|
||||
|
||||
- **`DTS.Slice.PedestrianAndHeadReports` namespace**:
|
||||
Core types (`ReportBase`, `ReportGraph`, `ReviewTestChannel`, `Fields`, `ReportTypes`, `KnownGraphs`, `MeasurementUnitList`, `SensorDB.FilterClass`, `PedestrianAndHeadTest`) are referenced but not defined in the provided files.
|
||||
|
||||
- **`DTS.Slice.Control.Event.Module.Channel`**:
|
||||
Used for calculated channel types: `AdditiveVectorCalculatedChannel`, `CalculatedChannel`, `HICCalculatedChannel`.
|
||||
|
||||
- **`DTS.DAS.Concepts.DAS.Channel.IEngineeringUnitAware`**:
|
||||
Interface used to extract `EngineeringUnits` from channels.
|
||||
|
||||
- **`DTS.Calculations` namespace**:
|
||||
Used for `ChannelData`, `Resultant.GenerateResultantChannel`, `HeadInjuryCriterion.GetHeadInjuryCriterion`.
|
||||
|
||||
- **`C1.Win.C1Command`**:
|
||||
Base class `C1DockingTabPage` for UI tabs.
|
||||
|
||||
- **`System.ComponentModel`**:
|
||||
`INotifyPropertyChanged` used for data binding.
|
||||
|
||||
### External Dependencies
|
||||
|
||||
- **DocumentFormat.OpenXml**:
|
||||
Used by `ExportBase` for Excel generation.
|
||||
|
||||
- **System.Windows.Forms**:
|
||||
`UserControl` base for UI controls.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`LWRLegTRLReport` displacement calculation uses hardcoded geometry**:
|
||||
Bending displacement uses ratio `59.5/43.5` and shear uses `27.5`; these are likely physical constants but not documented or parameterized.
|
||||
|
||||
- **`HeadReport` assumes unit consistency**:
|
||||
`System.Diagnostics.Trace.Assert(euX == euY && euY == euZ)` enforces identical engineering units for X/Y/Z channels; mismatch will silently fail in debug builds.
|
||||
|
||||
- **`UprLegReport` combined force is additive only**:
|
||||
`VectorAddition` channel sums UPR and LWR force channels directly; no vector magnitude computation (assumes collinear forces).
|
||||
|
||||
- **`ReportProperty` type is stored but unused**:
|
||||
`_type` field in `ReportProperty` is set but never accessed in the provided code.
|
||||
|
||||
- **`LWRLegFlexReport.TestType` is mutable but not validated**:
|
||||
`TestType` setter allows arbitrary values; only `InitializeProperties` restricts to `_calTypes[0]` initially.
|
||||
|
||||
- **`ExportBase.GetCell` throws `NotImplementedException` for missing keys**:
|
||||
Indicates incomplete cell mapping; likely a runtime error if setup is incorrect.
|
||||
|
||||
- **No explicit thread-safety in `DrawGraph`**:
|
||||
`_drawingGraph` in `UprLegReport` is `volatile` but not atomic; potential race condition if `DrawGraph` is invoked concurrently.
|
||||
|
||||
- **`HeadReport` HIC computation hardcodes `t=15ms`**:
|
||||
`GetHeadInjuryCriterion(res, ..., 15)` uses fixed integration window; not configurable.
|
||||
|
||||
- **`LWRLegARSReport` uses `KnownGraphs.ARS_ARS` and `KnownGraphs.ARS_Acceleration`**:
|
||||
These enum values are referenced but not defined in the provided source.
|
||||
|
||||
- **`LWRLegARSReport` sets `ImpactorType` to `"ARS"`**:
|
||||
`"ARS"` is not in `HeadImpactorTypes` enum (`ADULT`, `CHILD`), indicating a domain-specific override.
|
||||
|
||||
- **`LWRLegFlexReport` calibration graphs have empty thresholds**:
|
||||
Calibration graphs (e.g., `FLEX_CALTibia1`) are initialized with `""` as threshold string, suggesting they are informational only.
|
||||
|
||||
- **`PedestrianSetupTab.ReportBase_PropertyChanged` passes `UI.PropertyChanged(...)` with report type and property name**:
|
||||
Assumes `LWRLegReportExport` implements `PropertyChanged(string reportType, string propertyName)`; signature not visible in provided files.
|
||||
|
||||
- **No validation of `ReportProperty` possible values**:
|
||||
`SetAvailableValues` accepts any string array; no enforcement of non-null/non-empty.
|
||||
|
||||
- **`GraphChannel.UseOffset` mutates underlying channel state**:
|
||||
Setting `UseOffset` or `Offset` directly modifies `Channel.Channel.UserOffsetEU`, which may affect other consumers of the channel.
|
||||
|
||||
- **`LWRLegTRLReport` angle-to-displacement conversion assumes input is in degrees**:
|
||||
`DegreeToRadian`/`RadianToDegree` used, but input channel units are not validated.
|
||||
|
||||
- **`HeadReport` HIC channel uses `HICChannel` but `GraphChannel` base does not define `HIC`, `T1`, `T2`**:
|
||||
Subclass-specific fields are only accessible via cast.
|
||||
|
||||
- **No documentation for `KnownGraphs` enum values**:
|
||||
Used extensively (e.g., `KnownGraphs.HEAD_Acceleration`) but not defined in provided sources.
|
||||
|
||||
- **`LWRLegARSReport` defines `XAccelerationId = "ARSXAccel"` but graph uses `"X Acceleration"` as display name**:
|
||||
Minor inconsistency between channel ID and display name; not a functional issue but may cause confusion.
|
||||
|
||||
- **`ExportBase` uses `Trace.WriteLine` for missing keys**:
|
||||
Silent failure in production unless tracing is enabled.
|
||||
|
||||
- **`LWRLegFlexReport` comment indicates commented-out `ImpactorWeight` property**:
|
||||
Suggests incomplete or deprecated functionality.
|
||||
|
||||
- **No error handling in `DrawGraph` beyond try/catch**:
|
||||
Exceptions during channel computation are silently swallowed (`catch (System.Exception) { }`), potentially masking data issues.
|
||||
|
||||
- **`ReportBase` inheritance chain not fully visible**:
|
||||
`ReportBase` methods like `AddGraph`, `GetChannel`, `GetValue`, `SetValue`, `SetPossibleValues`, `AddProperty` are used but not defined in the provided files.
|
||||
|
||||
- **`LWRLegARSReport` uses `Properties.Settings.Default.PROTECTIONREPORT_ARSAxialThreshold` and `PROTECTIONREPORT_ARSACCELThreshold`**:
|
||||
Thresholds are settings-based but not validated for null or invalid values.
|
||||
|
||||
- **`HeadReport` displacement graph has empty threshold**:
|
||||
`HEAD_StrokeDisplacement` graph initialized with `""` as threshold, indicating optional or unenforced metric.
|
||||
|
||||
- **`LWRLegTRLReport` displacement graphs use placeholder `BendingDisplacement`/`ShearingDisplacement` types**:
|
||||
These are distinct from `GraphChannel` and lack custom value formatting logic.
|
||||
|
||||
- **`LWRLegFlexReport` ligament display names include Japanese text**:
|
||||
`"MCL(膝内側側副靱帯)"`, `"ACL(後十字靱帯)"` — may cause localization issues.
|
||||
|
||||
- **`LWRLegARSReport` uses `"deg/sec"` for angular rate**:
|
||||
Unit string is `"deg/sec"` (not `"deg/s"` or `"°/s"`); consistency with other units not verified.
|
||||
|
||||
- **`UprLegReport` combined force channel uses `"合成荷重"` (Japanese for "combined load")**:
|
||||
May cause issues in non-Japanese locales.
|
||||
|
||||
- **`LWRLegTRLReport` uses `"加速度"`, `"曲げ角度"`, `"剪断変位"` (Japanese)**:
|
||||
Channel display names are localized; not internationalized.
|
||||
|
||||
- **`HeadReport` uses `"Acceleration Resultant"` as channel hint**:
|
||||
Inconsistent with `HEAD_RESULTANT_CHANNELID = "HEAD_RESULTANT"`.
|
||||
|
||||
- **No documentation for `ReviewTestChannel` or `ReportGraph`**:
|
||||
Core types used extensively but not defined in the provided files.
|
||||
|
||||
- **`LWRLegARSReport` uses `KnownGraphs.ARS_ARS.ToString()` and `KnownGraphs.ARS_Acceleration.ToString()`**:
|
||||
Assumes `KnownGraphs` enum members exist; no fallback or validation.
|
||||
|
||||
- **`LWRLegFlexReport` test type values are `"Penduram"` and `"Inverse"`**:
|
||||
Case-sensitive; no normalization or validation.
|
||||
|
||||
- **`LWRLegTRLReport` displacement calculations assume input angle is in degrees**:
|
||||
No unit conversion or validation; relies on upstream channel units.
|
||||
|
||||
- **`HeadReport` HIC computation uses `res.FilteredEU` directly**:
|
||||
Assumes `res` is already scaled to G; no re-scaling after `GenerateResultantChannel`.
|
||||
|
||||
- **`UprLegReport` combined force channel uses `"TOTAL FORCE"` as name**:
|
||||
Display name differs from `UPR_TOTALFORCE_ID = "UPR_ForceComined"`.
|
||||
|
||||
- **`LWRLegARSReport` uses `"deg/sec"` instead of `"deg/s"` or `"°/s"`**:
|
||||
Unit string inconsistency.
|
||||
|
||||
- **`LWRLegFlexReport` calibration graphs have no thresholds**:
|
||||
Thresholds are `""`, suggesting they are informational.
|
||||
|
||||
- **`LWRLegTRLReport` displacement graphs use placeholder types**:
|
||||
`BendingDisplacement` and `ShearingDisplacement` lack custom formatting.
|
||||
|
||||
- **`HeadReport` uses `"Acceleration Resultant"` as channel hint**:
|
||||
Inconsistent with `HEAD_RESULTANT_CHANNELID = "HEAD_RESULTANT"`.
|
||||
|
||||
- **`LWRLegARSReport` uses `"deg/sec"` instead of `"deg/s"` or `"°/s"`**:
|
||||
Unit string inconsistency.
|
||||
|
||||
- **`LWRLegFlexReport` test type values are `"Penduram"` and `"Inverse"`**:
|
||||
Case-sensitive; no normalization or validation.
|
||||
|
||||
- **`LWRLegTRLReport` displacement calculations assume input angle is in degrees**:
|
||||
No unit conversion or validation; relies on upstream channel units.
|
||||
|
||||
- **`HeadReport` HIC computation uses `res.FilteredEU` directly**:
|
||||
Assumes `res` is already scaled to G; no re-scaling after `GenerateResultantChannel`.
|
||||
|
||||
- **`Upr
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:55:10.463307+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "18e81d9c1ee67a5c"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## 1. Purpose
|
||||
This module (`PedestrianAndHeadReports`) is a .NET assembly dedicated to generating reports related to pedestrian and head-related data within the broader system. Based solely on the assembly metadata, it serves as a modular component—likely part of a larger reporting framework—whose specific report-generation logic resides elsewhere (e.g., in other types within this assembly or referenced modules), but is not exposed or defined in the provided source file. Its role is to encapsulate and version this functionality as a discrete unit, identifiable by its GUID and assembly attributes.
|
||||
|
||||
## 2. Public Interface
|
||||
**No public types, functions, classes, or methods are defined in this file.**
|
||||
`AssemblyInfo.cs` contains only assembly-level attributes (e.g., versioning, COM visibility, title) and does not declare any executable code or public API surface. All declarations are metadata attributes applied to the assembly as a whole.
|
||||
|
||||
## 3. Invariants
|
||||
- The assembly is **not visible to COM** (`ComVisible(false)`), meaning its types cannot be consumed via COM interop unless explicitly overridden at the type level (which is not done here).
|
||||
- The assembly version is fixed at `1.0.0.0` for both `AssemblyVersion` and `AssemblyFileVersion`, with no wildcard (`*`) expansion used for build/revision.
|
||||
- The assembly GUID is `99a3fc18-ead0-4ead-bdee-777e0d286234`, used for type library identification when exposed to COM (though `ComVisible` is `false`, the GUID remains defined).
|
||||
- The assembly title is `"PedestrianAndHeadReports"` and the product name is `"PedestrianAndHeadReportsModule"`.
|
||||
|
||||
## 4. Dependencies
|
||||
- **System.Reflection**, **System.Runtime.CompilerServices**, **System.Runtime.InteropServices** (via `using` directives and implicit framework references).
|
||||
- No external project or module dependencies are declared in this file.
|
||||
- This assembly likely *depends on* other modules in the codebase (e.g., core reporting or domain models), but such dependencies are not visible here.
|
||||
- It is *consumed by* the build/deployment system (as an assembly), and potentially by other modules that reference it, though no such references are declared in this file.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No executable logic**: This file is purely metadata and does not contain business logic; developers should not expect to find report-generation code here.
|
||||
- **Versioning rigidity**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`, which may indicate legacy or placeholder state—ensure versioning strategy is handled elsewhere (e.g., CI/CD or shared props files).
|
||||
- **COM visibility**: While `ComVisible(false)` is set, the presence of a `Guid` attribute suggests this assembly *may have been* designed for COM exposure at some point; verify whether COM interop is still a requirement.
|
||||
- **Missing documentation**: `AssemblyDescription`, `AssemblyConfiguration`, and `AssemblyTrademark` are empty—this may indicate incomplete metadata hygiene.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:55:02.133936+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b181762eeb96b72d"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides a WPF `MarkupExtension` (`TranslateExtension`) to enable declarative, localized string resolution in XAML. It allows UI elements (e.g., `TextBlock.Text`, `Header`, etc.) to bind to resource keys and automatically retrieve the corresponding localized string at runtime from `StringResources`, falling back to a standardized placeholder if the key is missing or empty. Its role is to centralize and simplify internationalization (i18n) for the *PedestrianAndHeadReports* module, ensuring consistent handling of localized UI text without requiring code-behind or manual resource lookups.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TranslateExtension` class
|
||||
**Namespace:** `PedestrianAndHeadReports.Resources`
|
||||
**Inherits:** `System.Windows.Markup.MarkupExtension`
|
||||
|
||||
##### Constructor
|
||||
```csharp
|
||||
public TranslateExtension(string key)
|
||||
```
|
||||
- **Purpose:** Initializes a new instance with the specified resource key.
|
||||
- **Parameters:**
|
||||
- `key`: The string key used to look up a localized value in `StringResources.ResourceManager`.
|
||||
|
||||
##### `ProvideValue` method
|
||||
```csharp
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
```
|
||||
- **Purpose:** Returns the localized string corresponding to `_key`, or a fallback value if lookup fails.
|
||||
- **Behavior:**
|
||||
- If `_key` is `null` or empty → returns `"#stringnotfound#"`.
|
||||
- Otherwise, calls `StringResources.ResourceManager.GetString(_key)`.
|
||||
- If the result is non-null → returns the localized string.
|
||||
- If the result is `null` → returns `"#stringnotfound# " + _key` (i.e., the placeholder followed by a space and the original key).
|
||||
- **Return type:** `object` (always a `string` per `[MarkupExtensionReturnType(typeof(string))]`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **Key must be non-null/non-empty for meaningful lookup:**
|
||||
Empty or `null` keys are explicitly handled and return `"#stringnotfound#"`—no exception is thrown.
|
||||
- **Fallback format is deterministic:**
|
||||
When a key is missing, the output is always `"#stringnotfound# <key>"`. This makes missing keys visually identifiable in the UI.
|
||||
- **Thread-safety of resource access is assumed:**
|
||||
`StringResources.ResourceManager.GetString(...)` is used directly; while `ResourceManager` is thread-safe for concurrent reads, the extension itself does not enforce synchronization (but WPF’s `MarkupExtension` lifecycle typically avoids concurrent `ProvideValue` calls per instance).
|
||||
- **Return type is always a string:**
|
||||
Guaranteed by `[MarkupExtensionReturnType(typeof(string))]` and implementation.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **`System.Windows.Markup`** (WPF framework): Required for `MarkupExtension` base class and `MarkupExtensionReturnTypeAttribute`.
|
||||
- **`PedestrianAndHeadReports.Resources.StringResources`**:
|
||||
- Used via `StringResources.ResourceManager.GetString(...)`.
|
||||
- `StringResources` is auto-generated from `.resx` files and contains strongly-typed properties (e.g., `Acceleration`, `TestDate`) backed by the `ResourceManager`.
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- **XAML files in the `PedestrianAndHeadReports` module** (inferred):
|
||||
- Likely used in XAML as `{local:Translate KeyName}` to localize UI elements.
|
||||
- Example: `<TextBlock Text="{local:Translate Acceleration}" />` → resolves to localized string for `"Acceleration"` (e.g., `"加速度"` in Japanese).
|
||||
|
||||
#### External dependencies:
|
||||
- **.NET Framework 4.0+** (inferred from runtime version in `StringResources.Designer.cs` header).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **No caching of resolved values per instance:**
|
||||
Each call to `ProvideValue` performs a fresh `ResourceManager.GetString(_key)` lookup. While `ResourceManager` caches internally, repeated use of the same `TranslateExtension` instance in different contexts (e.g., data templates) may re-resolve unnecessarily.
|
||||
- **Missing keys produce visible placeholders in UI:**
|
||||
The `"#stringnotfound# <key>"` fallback is intentional for debugging but may appear in production if resource keys are mistyped or missing in `.resx` files.
|
||||
- **Case sensitivity of keys:**
|
||||
Resource keys (e.g., `"Acceleration"`, `"Acceleration "`) are case-sensitive. A mismatch in casing (e.g., `"acceleration"`) will result in a `null` lookup and fallback.
|
||||
- **No support for parameterized strings (e.g., `string.Format`):**
|
||||
The extension only supports simple key → string lookup. It does not handle placeholders (e.g., `"Hello {0}"`) or arguments.
|
||||
- **Auto-generated `StringResources` class:**
|
||||
Changes to the underlying `.resx` file require regeneration of `StringResources.Designer.cs`. If keys are renamed/removed in `.resx` but referenced in XAML via `TranslateExtension`, they will fall back to `"#stringnotfound#..."`.
|
||||
- **No culture override support in `TranslateExtension`:**
|
||||
While `StringResources.Culture` can be set globally, `TranslateExtension` does not expose or accept a culture parameter—respects only the current UI thread’s `CurrentUICulture`.
|
||||
|
||||
> **None identified from source alone.**
|
||||
> *(Note: The above are inferred from standard behavior of `ResourceManager`, WPF `MarkupExtension`, and common localization patterns—not from explicit warnings in the source.)*
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/View/TRLReportInputView.xaml.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/View/HeadReportInputView.xaml.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/View/TRLReportOutputView.xaml.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/View/HeadReportOutputView.xaml.cs
|
||||
generated_at: "2026-04-16T04:55:23.286313+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "28e5f1753e7375ed"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
## Documentation: PedestrianAndHeadReports Module Views
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides WPF UI view classes for user input and output interfaces related to *TRL (Test Run Log)* and *Head* reports within the PedestrianAndHeadReports feature area. Each view class serves as the code-behind for a XAML-defined UI component, implementing an interface contract (`ITRLReportInputView`, `IHeadReportInputView`, etc.) defined in `DTS.Common.Interface`. These views are responsible for initializing their respective UI elements via `InitializeComponent()` and act as the presentation layer for report-related data entry and display in the DataPRO application.
|
||||
|
||||
> **Note**: The XML comments incorrectly reference `PowerAndBatteryView.xaml` for all views — this appears to be a copy-paste artifact and does not reflect the actual view names.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
All classes are `public partial` and inherit from `System.Windows.Controls.UserControl` (implied by WPF XAML code-behind pattern), implementing interfaces from `DTS.Common.Interface`.
|
||||
|
||||
| Class | Interface | Constructor | Behavior |
|
||||
|-------|-----------|-------------|----------|
|
||||
| `TRLReportInputView` | `ITRLReportInputView` | `public TRLReportInputView()` | Initializes the WPF UI component for TRL report *input*. Calls `InitializeComponent()` to wire up XAML-defined elements. |
|
||||
| `HeadReportInputView` | `IHeadReportInputView` | `public HeadReportInputView()` | Initializes the WPF UI component for Head report *input*. Calls `InitializeComponent()`. |
|
||||
| `TRLReportOutputView` | `ITRLReportOutputView` | `public TRLReportOutputView()` | Initializes the WPF UI component for TRL report *output*. Calls `InitializeComponent()`. |
|
||||
| `HeadReportOutputView` | `IHeadReportOutputView` | `public HeadReportOutputView()` | Initializes the WPF UI component for Head report *output*. Calls `InitializeComponent()`. |
|
||||
|
||||
> **Important**: No additional public methods, properties, or events are declared in the provided source. All behavior is delegated to the XAML-generated `InitializeComponent()` method and the interface implementations (whose definitions are not included here).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- Each view class must be instantiated only after its corresponding XAML file (e.g., `TRLReportInputView.xaml`) is compiled and embedded as a resource (standard WPF behavior).
|
||||
- `InitializeComponent()` must be called exactly once in the constructor — this is enforced by the generated code and is required for UI element initialization.
|
||||
- All four classes reside in the same namespace (`PedestrianAndHeadReports`), indicating tight coupling within the module.
|
||||
- The interfaces (`ITRLReportInputView`, etc.) are expected to be defined in `DTS.Common.Interface` and must be implemented by the respective classes (enforced at compile time).
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### Internal Dependencies
|
||||
- **XAML files**: Each `.xaml.cs` file depends on a corresponding `.xaml` file (e.g., `TRLReportInputView.xaml`) in the same directory. These define the UI layout and are compiled into the `InitializeComponent()` method.
|
||||
- **`DTS.Common.Interface` assembly**: Provides the four interface contracts (`ITRLReportInputView`, `IHeadReportInputView`, `ITRLReportOutputView`, `IHeadReportOutputView`). The module *must* reference this assembly.
|
||||
|
||||
#### External Dependencies (Inferred)
|
||||
- **WPF framework**: As a XAML-based UI module, it depends on `PresentationFramework`, `PresentationCore`, and `WindowsBase`.
|
||||
- **Consumers**: Other modules (e.g., a report controller or view model loader) are expected to instantiate and host these views, likely via the interface types (e.g., `ITRLReportInputView`) for decoupling.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Misleading XML comments**: All files share the same comment `/// <summary>Interaction logic for PowerAndBatteryView.xaml</summary>`, which is inconsistent with the actual view names. This may cause confusion during debugging or maintenance.
|
||||
- **No business logic exposed**: The source files contain *only* constructor boilerplate. All meaningful behavior (e.g., data binding, validation, event handling) resides in the XAML files or in associated view models/controllers — not visible here.
|
||||
- **Interface contract ambiguity**: Without access to the interface definitions in `DTS.Common.Interface`, it is impossible to determine:
|
||||
- Whether these views expose properties (e.g., `ReportData`, `IsInputValid`)
|
||||
- Whether they participate in event-driven workflows (e.g., `OnSaveRequested`)
|
||||
- Any lifecycle expectations (e.g., `IInitialize`, `IDisposable`)
|
||||
- **No error handling visible**: If `InitializeComponent()` fails (e.g., due to missing XAML), the exception will propagate from the constructor — but no defensive logic is present in the source.
|
||||
|
||||
> **Recommendation**: Review the corresponding `.xaml` files and the `DTS.Common.Interface` definitions to fully understand usage and behavior.
|
||||
@@ -0,0 +1,265 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/ViewModel/HeadReportViewModel.cs
|
||||
- DataPRO/Modules/Reports/PedestrianAndHeadReports/ViewModel/TRLReportViewModel.cs
|
||||
generated_at: "2026-04-16T04:55:26.671118+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3e435356eaf751fb"
|
||||
---
|
||||
|
||||
# Documentation: HeadReportViewModel and TRLReportViewModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
These two view models (`HeadReportViewModel` and `TRLReportViewModel`) serve as shared data contexts for input and output views in the Pedestrian and Head Reports module of the DataPRO application. They implement Prism-based MVVM patterns to manage UI state (e.g., busy indicators, dirty state, inclusion flags for menu/navigation), handle notification/confirmation interactions via `InteractionRequest`, and expose properties for report configuration (e.g., time/acceleration units, channel selections). `HeadReportViewModel` is a simpler implementation focused on generic report UI state, while `TRLReportViewModel` extends this with domain-specific properties and initialization logic tied to a `DTS.Serialization.Test` object, including channel population and unit filtering. Both are exported as views (`IHeadReportInputView`/`IHeadReportOutputView` and `ITRLReportInputView`/`ITRLReportOutputView`) and are intended to coordinate data flow between UI and backend (though current functionality is limited to XML string exchange per comments).
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `HeadReportViewModel`
|
||||
|
||||
- **`HeadReportViewModel(IHeadReportInputView inputView, IHeadReportOutputView outputView, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
|
||||
Constructor. Assigns views, sets up `DataContext`, initializes `InteractionRequest`s, and subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events.
|
||||
|
||||
- **`IHeadReportInputView InputView { get; set; }`**
|
||||
Reference to the input view instance.
|
||||
|
||||
- **`IHeadReportOutputView OutputView { get; set; }`**
|
||||
Reference to the output view instance.
|
||||
|
||||
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
|
||||
Prism interaction request used to trigger notification popups (e.g., alerts).
|
||||
|
||||
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
|
||||
Prism interaction request used to trigger confirmation dialogs.
|
||||
|
||||
- **`bool IsDirty { get; }`**
|
||||
Read-only property indicating whether the model has unsaved changes. *Currently never set to `true` in source.*
|
||||
|
||||
- **`bool IsBusy { get; set; }`**
|
||||
Bindable property indicating whether the UI is busy. Set via `OnBusyIndicatorNotification(bool)` event handler.
|
||||
|
||||
- **`bool IsMenuIncluded { get; set; }`**
|
||||
Bindable property indicating whether the report should include the menu. Defaults to `false`.
|
||||
|
||||
- **`bool IsNavigationIncluded { get; set; }`**
|
||||
Bindable property indicating whether the report should include navigation. Defaults to `false`.
|
||||
|
||||
- **`string HeaderInfo { get; }`**
|
||||
Returns the literal string `"MainRegion"`.
|
||||
|
||||
- **`void OnPropertyChanged(string propertyName)`**
|
||||
Raises the `PropertyChanged` event for the specified property.
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Standard `INotifyPropertyChanged` event.
|
||||
|
||||
- **Lifecycle methods (no-op):**
|
||||
`Cleanup()`, `CleanupAsync()`, `Initialize()`, `Initialize(object)`, `Initialize(object, object)`, `InitializeAsync()`, `InitializeAsync(object)`, `Activated()`
|
||||
All are empty stubs; no behavior implemented.
|
||||
|
||||
- **`OnRaiseNotification(NotificationContentEventArgs)`** *(private)*
|
||||
Event handler that reformats `NotificationContentEventArgs` and raises `NotificationRequest`.
|
||||
|
||||
- **`OnBusyIndicatorNotification(bool)`** *(private)*
|
||||
Event handler that sets `IsBusy` to the incoming boolean.
|
||||
|
||||
---
|
||||
|
||||
### `TRLReportViewModel`
|
||||
|
||||
- **`TRLReportViewModel(ITRLReportInputView inputView, ITRLReportOutputView outputView, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer, DTS.Serialization.Test test)`**
|
||||
Constructor. Initializes `Test`, `AvailableTimeUnits`, `SelectedTimeUnits`, `AvailableAccelerationUnits`, and `SelectedAccelerationUnit`. Calls `PopulateChannels()` to populate channel arrays. Assigns views, sets up `DataContext`, initializes `InteractionRequest`s, and subscribes to events.
|
||||
|
||||
- **`ITRLReportInputView InputView { get; set; }`**
|
||||
Reference to the input view instance.
|
||||
|
||||
- **`ITRLReportOutputView OutputView { get; set; }`**
|
||||
Reference to the output view instance.
|
||||
|
||||
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
|
||||
Prism interaction request for notifications.
|
||||
|
||||
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
|
||||
Prism interaction request for confirmations.
|
||||
|
||||
- **`DTS.Serialization.Test Test { get; set; }`**
|
||||
The test object used to populate channels and metadata.
|
||||
|
||||
- **`bool IsDirty { get; }`**
|
||||
Read-only property indicating unsaved changes. *Currently never set to `true`.*
|
||||
|
||||
- **`bool IsBusy { get; set; }`**
|
||||
Bindable busy state. Set via `OnBusyIndicatorNotification(bool)`.
|
||||
|
||||
- **`bool IsMenuIncluded { get; set; }`**
|
||||
Bindable flag for menu inclusion. Defaults to `false`.
|
||||
|
||||
- **`bool IsNavigationIncluded { get; set; }`**
|
||||
Bindable flag for navigation inclusion. Defaults to `false`.
|
||||
|
||||
- **`string HeaderInfo { get; }`**
|
||||
Returns `"MainRegion"`.
|
||||
|
||||
- **`string TestNumber { get; set; }`**
|
||||
Bindable string for test number.
|
||||
|
||||
- **`string DateTimeText { get; set; }`**
|
||||
Bindable string representation of `_dateTime`. Getter uses `CultureInfo.CurrentCulture`; setter parses via `DateTime.Parse`.
|
||||
|
||||
- **`string CarName { get; set; }`**
|
||||
Bindable string for car name.
|
||||
|
||||
- **`string Model { get; set; }`**
|
||||
Bindable string for model.
|
||||
|
||||
- **`string TestTemperature { get; set; }`**
|
||||
Bindable string for test temperature.
|
||||
|
||||
- **`string MeasurementPoint { get; set; }`**
|
||||
Bindable string for measurement point.
|
||||
|
||||
- **`string CrashVelocity { get; set; }`**
|
||||
Bindable string for crash velocity.
|
||||
|
||||
- **`string ImpactorID { get; set; }`**
|
||||
Bindable string for impactor ID.
|
||||
|
||||
- **`string[] AvailableImpactorTypes => throw new NotImplementedException();`**
|
||||
*Unimplemented*; throws `NotImplementedException`.
|
||||
|
||||
- **`string SelectedImpactor { get; set; }`**
|
||||
Bindable string for selected impactor.
|
||||
|
||||
- **`string ImpactorWeight { get; set; }`**
|
||||
Bindable string for impactor weight.
|
||||
|
||||
- **`string Examiner { get; set; }`**
|
||||
Bindable string for examiner name.
|
||||
|
||||
- **`string Reserved1 { get; set; }`**
|
||||
Bindable string for reserved field 1.
|
||||
|
||||
- **`string Reserved2 { get; set; }`**
|
||||
Bindable string for reserved field 2.
|
||||
|
||||
- **`DTS.SensorDB.FilterClass[] AvailableCFCs => throw new NotImplementedException();`**
|
||||
*Unimplemented*; throws `NotImplementedException`.
|
||||
|
||||
- **`DTS.SensorDB.FilterClass SelectedCFC { get; set; }`**
|
||||
Bindable filter class.
|
||||
|
||||
- **`DTS.SensorDB.MeasurementUnit[] AvailableAccelerationUnits { get; set; }`**
|
||||
Array of available acceleration units (initialized to `"m/sec^2"` and `"g"`).
|
||||
|
||||
- **`DTS.SensorDB.MeasurementUnit SelectedAccelerationUnit { get; set; }`**
|
||||
Selected acceleration unit. Defaults to first in `AvailableAccelerationUnits`.
|
||||
|
||||
- **`ConstantsAndEnums.TimeUnits[] AvailableTimeUnits { get; set; }`**
|
||||
Array of available time units (`Seconds`, `MilliSeconds`).
|
||||
|
||||
- **`ConstantsAndEnums.TimeUnits SelectedTimeUnits { get; set; }`**
|
||||
Selected time unit. Defaults to `Seconds`.
|
||||
|
||||
- **`Event.Module.AnalogInputChannel[] AccelerationChannels { get; set; }`**
|
||||
Array of acceleration channels (populated in `PopulateChannels()`).
|
||||
|
||||
- **`Event.Module.Channel SelectedAccelerationChannel { get; set; }`**
|
||||
Selected acceleration channel.
|
||||
|
||||
- **`Event.Module.AnalogInputChannel[] AvailableBendingChannels { get; set; }`**
|
||||
Array of bending channels (populated in `PopulateChannels()`).
|
||||
|
||||
- **`Event.Module.Channel SelectedBendingChannel { get; set; }`**
|
||||
Selected bending channel.
|
||||
|
||||
- **`Event.Module.AnalogInputChannel[] AvailableShearChannels { get; set; }`**
|
||||
Array of shear channels (populated in `PopulateChannels()`).
|
||||
|
||||
- **`Event.Module.Channel SelectedShearChannel { get; set; }`**
|
||||
Selected shear channel.
|
||||
|
||||
- **`void PopulateChannels()`** *(private)*
|
||||
Filters `Test.Channels` into acceleration, bending, and shear channel arrays based on engineering units. Uses `DTS.SensorDB.MeasurementUnitList.GetMeasurementUnit()` for unit lookups.
|
||||
|
||||
- **`void OnPropertyChanged(string propertyName)`**
|
||||
Raises `PropertyChanged` event.
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Standard `INotifyPropertyChanged` event.
|
||||
|
||||
- **Lifecycle methods (no-op):**
|
||||
Same as `HeadReportViewModel`: `Cleanup()`, `CleanupAsync()`, `Initialize()`, `Initialize(object)`, `Initialize(object, object)`, `InitializeAsync()`, `InitializeAsync(object)`, `Activated()` — all empty.
|
||||
|
||||
- **`OnRaiseNotification(NotificationContentEventArgs)`** *(private)*
|
||||
Same behavior as in `HeadReportViewModel`.
|
||||
|
||||
- **`OnBusyIndicatorNotification(bool)`** *(private)*
|
||||
Same behavior as in `HeadReportViewModel`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **View-ViewModel Binding**: Both `InputView` and `OutputView` have their `DataContext` set to `this` in the constructor. This binding is immutable after construction.
|
||||
- **Event Subscription**: Both view models subscribe to `RaiseNotification` and `BusyIndicatorChangeNotification` events during construction. Subscriptions are not cleaned up (no `Unsubscribe` calls).
|
||||
- **`IsBusy` State**: `IsBusy` is always set via `OnBusyIndicatorNotification(bool)` and never modified directly elsewhere in the code.
|
||||
- **`IsDirty` State**: `IsDirty` is read-only and *never set to `true`* in the provided code. Its value remains `false` for the lifetime of the object.
|
||||
- **`HeaderInfo`**: Always returns `"MainRegion"`; no dynamic behavior.
|
||||
- **`Test` Object**: In `TRLReportViewModel`, `Test` must be non-null before `PopulateChannels()` is called (called in constructor), or `Test.Channels` will throw `NullReferenceException`.
|
||||
- **Channel Population Logic**: `PopulateChannels()` only processes channels where `ch.emc is Event.Module.AnalogInputChannel`. Non-analog channels are skipped.
|
||||
- **Unit Matching**: Channel filtering uses `unit.UnitMatches(emc.EngineeringUnits)` — behavior depends on implementation of `UnitMatches`, not visible in source.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies (from imports)
|
||||
- **Prism Framework**:
|
||||
- `Microsoft.Practices.Prism.Events` (`IEventAggregator`, `RaiseNotification`, `BusyIndicatorChangeNotification`)
|
||||
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` (`InteractionRequest<T>`, `Notification`, `Confirmation`)
|
||||
- `Microsoft.Practices.Prism.Regions` (`IRegionManager`)
|
||||
- `Microsoft.Practices.Prism.Commands` (`DelegateCommand`, *commented out but referenced*)
|
||||
- **Unity Container**: `Microsoft.Practices.Unity` (`IUnityContainer`)
|
||||
- **Common Libraries**:
|
||||
- `DTS.Common.Events` (`RaiseNotification`, `BusyIndicatorChangeNotification`, `NotificationContentEventArgs`)
|
||||
- `DTS.Common.Interface` (`IHeadReportInputView`, `IHeadReportOutputView`, `ITRLReportInputView`, `ITRLReportOutputView`, `IHeadReportViewModel`, `ITRLReportViewModel`)
|
||||
- `DTS.Common.Utils` (unused in visible code)
|
||||
- `DTS.Serialization.Test` (`Test` property in `TRLReportViewModel`)
|
||||
- `DTS.SensorDB.MeasurementUnitList`, `DTS.SensorDB.FilterClass`, `DTS.SensorDB.MeasurementUnit`
|
||||
- `PedestrianAndHeadReports.Classes` (`ConstantsAndEnums.TimeUnits`)
|
||||
- `DTS.Slice.Control` (unused in visible code)
|
||||
- **System Libraries**:
|
||||
- `System.ComponentModel` (`INotifyPropertyChanged`)
|
||||
- `System.Threading.Tasks` (`Task`)
|
||||
- `System.Linq` (`Where`, `AddRange`)
|
||||
- `System.Collections.Generic` (`List<T>`, `Array`)
|
||||
- `System.Text` (unused in visible code)
|
||||
|
||||
### External Dependencies
|
||||
- **UI Framework**: WPF (inferred from Prism usage, `InteractionRequest`, and `OpenFileDialog` in commented code).
|
||||
- **Export Contracts**:
|
||||
- `IHeadReportInputView`, `IHeadReportOutputView` (for `HeadReportViewModel`)
|
||||
- `ITRLReportInputView`, `ITRLReportOutputView` (for `TRLReportViewModel`)
|
||||
These interfaces must be implemented by views in the UI layer.
|
||||
|
||||
### What Depends on This Module?
|
||||
- The application shell or region manager must import and display views of type `IHeadReportInputView`, `IHeadReportOutputView`, `ITRLReportInputView`, and `ITRLReportOutputView`.
|
||||
- Event publishers for `RaiseNotification` and `BusyIndicatorChangeNotification` must exist (e.g., a global busy indicator manager or notification service).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`IsDirty` is never updated**: Both view models expose `IsDirty` as a read-only property, but it is never set to `true`. This may mislead consumers expecting change tracking.
|
||||
- **`NotImplementedException` in `TRLReportViewModel`**: `AvailableImpactorTypes` and `AvailableCFCs` throw `NotImplementedException`. Any binding to these properties will crash at runtime.
|
||||
- **`DateTimeText` setter is unsafe**: Uses `DateTime.Parse(value)` without culture or exception handling. May throw `FormatException` or `OverflowException` on invalid input.
|
||||
- **No cleanup logic**: `Cleanup()` and `CleanupAsync()` are empty stubs. Event subscriptions (`_eventAggregator.GetEvent<...>().Subscribe(...)`) are never unsubscribed, risking memory leaks.
|
||||
- **Channel population assumes non-null `Test`**: `PopulateChannels()` accesses `Test.Channels` without null checks. If `Test` is `null`, a `NullReferenceException` occurs during construction.
|
||||
- **`UnitMatches` behavior unknown**: Filtering channels relies on `unit.UnitMatches(...)`, whose implementation is not visible. May cause incorrect channel inclusion/exclusion.
|
||||
- **Redundant code**: Both view models duplicate identical logic for `OnRaiseNotification`, `OnBusyIndicatorNotification`, and lifecycle methods. Consider refactoring to a base class.
|
||||
- **Commented-out import logic**: Both files contain commented-out `ImportBrowseCommand` and related code. This suggests incomplete or deprecated functionality; avoid relying on it.
|
||||
- **Namespace `PedestrianAndHeadReports`**: Despite the namespace, `HeadReportViewModel` is *not* used for pedestrian reports (per file path and naming), only head reports. `TRLReportViewModel` appears to handle TRL (Test Report Layout) reports.
|
||||
- **`HeaderInfo` is hardcoded**: Returns `"MainRegion"` literally — likely a placeholder or legacy value with no dynamic meaning.
|
||||
Reference in New Issue
Block a user