init
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/SensorSettingsModule.cs
|
||||
generated_at: "2026-04-16T04:52:27.209220+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bc0bfa8f9086804f"
|
||||
---
|
||||
|
||||
# SensorSettingsModule
|
||||
|
||||
### **1. Purpose**
|
||||
This module, named `SensorSettingsModule`, is a Prism-based modular component responsible for registering the view and view model for the sensor settings UI within a modular WPF application. It integrates with the Unity dependency injection container to expose `ISensorSettingsView` and `ISensorSettingsViewModel` as singleton services, enabling the main application shell to display and manage sensor configuration UI. It also contributes metadata (name, image, group, region) to the host application’s module discovery and UI assembly system via custom assembly-level attributes.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
|
||||
#### **`SensorSettingsModuleModule` class**
|
||||
- **`public SensorSettingsModuleModule(IUnityContainer unityContainer)`**
|
||||
Constructor that receives the Unity container via dependency injection. Stores the container for later use in type registration.
|
||||
|
||||
- **`public void Initialize()`**
|
||||
Registers the following types as singletons in the Unity container:
|
||||
- `ISensorSettingsView` → `SensorSettingsView`
|
||||
- `ISensorSettingsViewModel` → `SensorSettingsViewModel`
|
||||
This method is called both directly by the constructor’s usage pattern (via `RegisterTypes`) and by Prism’s module initialization pipeline.
|
||||
|
||||
- **`public void OnInitialized(IContainerProvider containerProvider)`**
|
||||
Currently empty; no logic is executed during Prism’s `OnInitialized` phase.
|
||||
|
||||
- **`public void RegisterTypes(IContainerRegistry containerRegistry)`**
|
||||
Delegates to `Initialize()` (despite using a different container interface, `IContainerRegistry`, the method still invokes the internal `Initialize()` that uses `_unityContainer`). *Note: This may indicate a potential inconsistency, as `containerRegistry` is unused.*
|
||||
|
||||
#### **`[assembly: SensorSettingsModuleModuleName]`**
|
||||
- **`SensorSettingsModuleModuleNameAttribute` class**
|
||||
- **`public override string AssemblyName { get; }`**
|
||||
Returns `"SensorSettingsModule"` (via `AssemblyNames.SensorSettingsModule.ToString()`).
|
||||
- **`public override Type GetAttributeType()`**
|
||||
Returns `typeof(TextAttribute)`.
|
||||
- **`public override string GetAssemblyName()`**
|
||||
Returns the value of `AssemblyName`.
|
||||
|
||||
#### **`[assembly: SensorSettingsModuleModuleImageAttribute]`**
|
||||
- **`SensorSettingsModuleModuleImageAttribute` class**
|
||||
- **`public override BitmapImage AssemblyImage { get; }`**
|
||||
Returns a `BitmapImage` loaded via `AssemblyInfo.GetImage("SensorSettingsModule")`.
|
||||
- **`public override string AssemblyName { get; }`**
|
||||
Returns `"SensorSettingsModule"`.
|
||||
- **`public override string AssemblyGroup { get; }`**
|
||||
Returns `"Administrative"` (via `eAssemblyGroups.Administrative.ToString()`).
|
||||
- **`public override eAssemblyRegion AssemblyRegion { get; }`**
|
||||
Returns `eAssemblyRegion.SensorSettingsModuleRegion`.
|
||||
- **`public override Type GetAttributeType()`**
|
||||
Returns `typeof(ImageAttribute)`.
|
||||
- **`public override BitmapImage GetAssemblyImage()` / `GetAssemblyName()` / `GetAssemblyGroup()` / `GetAssemblyRegion()`**
|
||||
Delegate to their respective properties.
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- The module **must** be loaded into a Prism-based application using Unity as the DI container.
|
||||
- `ISensorSettingsView` and `ISensorSettingsViewModel` are registered as **singletons** (per container lifetime).
|
||||
- The `AssemblyName` for this module is strictly `"SensorSettingsModule"` (derived from `AssemblyNames.SensorSettingsModule` enum).
|
||||
- The module belongs to the `"Administrative"` group (`eAssemblyGroups.Administrative`) and is assigned to `eAssemblyRegion.SensorSettingsModuleRegion`.
|
||||
- The module image is loaded from a static `AssemblyInfo.GetImage(...)` method, implying a fixed image resource naming convention (`"SensorSettingsModule"`).
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
#### **Imports / External Dependencies**
|
||||
- **Prism.Modularity** (`IModule`, `ModuleAttribute`) — for module lifecycle integration.
|
||||
- **Unity** (`IUnityContainer`, `IContainerRegistry`) — for DI container access.
|
||||
- **DTS.Common** and **DTS.Common.Interface** — defines core contracts:
|
||||
- `ISensorSettingsView`, `ISensorSettingsViewModel` (from `DTS.Common.Interface.Sensors.SensorSettingsModule`)
|
||||
- `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`, `TextAttribute`, `ImageAttribute` — used by attributes.
|
||||
- **System.Windows.Media.Imaging** — for `BitmapImage` type.
|
||||
|
||||
#### **Depended Upon**
|
||||
- The host application (via Prism’s module catalog) depends on this module to provide sensor settings UI.
|
||||
- Other modules or views may depend on `ISensorSettingsView`/`ISensorSettingsViewModel` being registered (e.g., to inject or navigate to the view).
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **`RegisterTypes` uses `IContainerRegistry` but calls `Initialize()` which uses `_unityContainer` (of type `IUnityContainer`)** — this may cause confusion or runtime issues if `IContainerRegistry` is not internally backed by the same Unity container instance. The `containerRegistry` parameter is unused.
|
||||
- **`OnInitialized` is empty** — if future logic is added here, it must be compatible with Prism’s module initialization order.
|
||||
- **Assembly-level attributes are applied unconditionally** — their behavior relies on `AssemblyNames.SensorSettingsModule` and `AssemblyInfo.GetImage(...)` being correctly defined elsewhere in `DTS.Common`.
|
||||
- **No validation or error handling is visible** — if `AssemblyInfo.GetImage(...)` fails (e.g., missing image resource), the attribute constructor may throw silently or return null (behavior depends on `AssemblyInfo` implementation).
|
||||
- **No public API beyond module registration** — this module does not expose domain logic; it only bootstraps UI components.
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/Properties/Settings.Designer.cs
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:53:05.459294+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "76809d77f0815bad"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## Documentation Page: SensorSettingsModule.Properties.Settings
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides a strongly-typed settings class (`SensorSettingsModule.Properties.Settings`) for managing application-level configuration values in a .NET Framework 4.0 Windows Forms or WPF application. It serves as the runtime accessor for user- or application-scoped settings defined elsewhere (e.g., in `app.config` or via the Visual Studio Settings Designer), leveraging the built-in `ApplicationSettingsBase` infrastructure. The module itself contains only the auto-generated wrapper class and assembly metadata; it does not define or persist settings values directly—those are expected to be declared in the corresponding `Settings.settings` file (not provided here) and compiled into the `Settings.Designer.cs` class.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
- **`Settings.Default` (static property)**
|
||||
```csharp
|
||||
public static Settings Default { get; }
|
||||
```
|
||||
Returns the singleton instance of the `Settings` class, synchronized for thread safety via `ApplicationSettingsBase.Synchronized`. This is the primary entry point for reading or writing settings values. All settings properties (e.g., `string SomeSetting { get; set; }`) are defined in the designer-generated class body (not visible in the provided source), but their access is mediated through this instance.
|
||||
|
||||
> **Note**: The provided `Settings.Designer.cs` file contains *no explicit settings properties*—only the `Default` property and boilerplate attributes. Actual settings (e.g., `public string SensorTimeout { get; set; }`) must be declared in the corresponding `.settings` file and regenerated into this class. Their signatures and behaviors cannot be inferred from the current source.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- The `Settings` class is **sealed** and **partial**, with thread-safe singleton access via `Synchronized`.
|
||||
- The `Default` property is guaranteed to return a non-null instance (initialized lazily in a static constructor).
|
||||
- The class inherits from `System.Configuration.ApplicationSettingsBase`, which enforces:
|
||||
- Settings values are persisted per-user (user-scoped) or per-application (application-scoped) based on `UserScopedSettingAttribute`/`ApplicationScopedSettingAttribute` applied to individual properties (not visible here).
|
||||
- Settings are loaded on first access and saved explicitly via `Save()` (not shown in this file).
|
||||
- No validation or business logic is present in the provided source—only infrastructure.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Dependencies *of* this module**:
|
||||
- `System.Configuration.dll` (for `ApplicationSettingsBase`, `SettingsProperty`, etc.)
|
||||
- `System.dll` (for core types like `System.Object`, `System.Runtime.CompilerServices.CompilerGeneratedAttribute`, etc.)
|
||||
- Visual Studio’s `Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator` (used at design time to generate this file; not a runtime dependency).
|
||||
|
||||
- **Dependencies *on* this module**:
|
||||
- Other modules in `SensorSettingsModule` (e.g., UI or logic layers) likely consume `Settings.Default` to read/write configuration (e.g., `Settings.Default.SensorPollingInterval = 5000;`).
|
||||
- The assembly `SensorSettingsModule` (GUID `32dfec83-bdc6-4d9c-be01-be5441e3d8e6`) depends on this `Properties.Settings` class for configuration management.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Settings properties are not visible in the provided source**: The actual settings (e.g., names, types, default values) are generated from `Properties/Settings.settings` and embedded in the `Settings.Designer.cs` file *after* build. Without that file, the API surface is incomplete.
|
||||
- **Thread safety is shallow**: While `Synchronized()` wraps the instance in a `SyncRoot`-based lock, `ApplicationSettingsBase` does *not* guarantee atomicity for compound operations (e.g., read-modify-write). Concurrent writes may require external locking.
|
||||
- **No persistence logic here**: This class only *accesses* settings; saving requires explicit calls to `Settings.Default.Save()`, typically from UI or lifecycle events (e.g., `Application.Exit`).
|
||||
- **Auto-generated warning is literal**: Manual edits to `Settings.Designer.cs` will be overwritten on next settings change or build.
|
||||
- **Assembly version is fixed at `1.0.0.0`**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded, which may cause binding issues if the module is versioned independently elsewhere.
|
||||
|
||||
> **None identified from source alone** beyond the above—specific settings behaviors (e.g., default values, scopes) require inspection of `Settings.settings` or `app.config`.
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:52:55.321656+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5a131daf903208d8"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Class
|
||||
|
||||
### 1. Purpose
|
||||
The `TranslateExtension` class provides a XAML markup extension for localizing UI strings within the `SensorSettingsModule`. It enables declarative binding of localized text in XAML resources by resolving a given string key against the module’s embedded resource manager (`StringResources`). Its role is to decouple UI text from code logic, supporting multi-language deployments by fetching culture-specific strings at runtime.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TranslateExtension(string key)`
|
||||
- **Signature**: `public TranslateExtension(string key)`
|
||||
- **Behavior**: Constructor. Stores the resource key (`_key`) used to look up a localized string. Throws no exceptions on invalid input; invalid keys are handled at `ProvideValue` time.
|
||||
|
||||
#### `ProvideValue(IServiceProvider serviceProvider)`
|
||||
- **Signature**: `public override object ProvideValue(IServiceProvider serviceProvider)`
|
||||
- **Behavior**:
|
||||
- Returns `#stringnotfound#` if `_key` is `null` or empty.
|
||||
- Otherwise, attempts to retrieve the string from `StringResources.ResourceManager.GetString(_key)`.
|
||||
- If the key exists in resources, returns the localized string.
|
||||
- If the key does *not* exist, returns `#stringnotfound# <key>` (e.g., `#stringnotfound# MyKey`).
|
||||
- Does *not* throw exceptions for missing keys—gracefully degrades via placeholder text.
|
||||
|
||||
### 3. Invariants
|
||||
- `_key` is never validated for format (e.g., no requirement to match resource names like `CamelCase` or `PascalCase`).
|
||||
- The returned value is always a `string` (per `[MarkupExtensionReturnType(typeof(string))]`).
|
||||
- Missing keys *never* cause exceptions; fallback is always a placeholder string.
|
||||
- Resource lookup uses the current thread’s `CurrentUICulture` unless overridden via `StringResources.Culture`.
|
||||
- `StringResources.ResourceManager` is lazily initialized and cached per AppDomain.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `System.Windows.Markup.MarkupExtension` (WPF framework)
|
||||
- `System.Resources.ResourceManager` (via `StringResources.ResourceManager`)
|
||||
- `SensorSettingsModule.Resources.StringResources` (strongly-typed resource class, auto-generated)
|
||||
- **Used by**:
|
||||
- XAML files in `SensorSettingsModule` (e.g., `<TextBlock Text="{local:Translate MyKey}" />`)
|
||||
- No other C# code appears to reference `TranslateExtension` directly in the provided sources.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Placeholder format is non-standard**: Missing keys yield `#stringnotfound# <key>`, which may be confusing in production if not caught during testing.
|
||||
- **No caching of resolved values**: Each `ProvideValue` call re-invokes `ResourceManager.GetString`, which *is* internally cached by .NET, but repeated calls for the same key in a tight loop may still incur overhead.
|
||||
- **No support for parameterized resources**: The extension only supports static key lookup; no interpolation (e.g., `{Translate Key, arg0}`) is possible.
|
||||
- **Auto-generated resource class**: `StringResources.Designer.cs` is regenerated on build—manual edits will be lost. Resource keys must be managed via `.resx` files.
|
||||
- **No null-safety for `serviceProvider`**: While not explicitly used, if `serviceProvider` is `null`, the base `MarkupExtension.ProvideValue` behavior applies (typically safe in WPF).
|
||||
- **No culture fallback logic**: If a key is missing in the current `Culture`, it returns the placeholder—even if the key exists in the default culture (e.g., `en-US`). Developers must ensure all keys exist in all target cultures.
|
||||
- **Hardcoded placeholder**: `#stringnotfound#` is a magic string; if UI designers accidentally use this as a key, it will be misinterpreted as an error.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/View/SensorSettingsView.xaml.cs
|
||||
generated_at: "2026-04-16T04:53:07.506286+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "97b808679cb582c0"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
### **Purpose**
|
||||
This module provides the UI view layer for configuring sensor settings, specifically handling user interaction related to filter frequency selection. It implements the `ISensorSettingsView` interface and integrates with the Prism event aggregation system to publish filter frequency values when the user finishes editing the filter option field. Its role is to capture transient user input (e.g., ad-hoc filter frequency values) and propagate them as events for downstream persistence or processing logic.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
The class `SensorSettingsView` implements the `ISensorSettingsView` interface (defined in `DTS.Common.Interface.Sensors.SensorSettingsModule`). However, the source file does **not** show the interface definition or any other public methods beyond the constructor and event handler. Based on the source:
|
||||
|
||||
- **`SensorSettingsView()`**
|
||||
Public constructor. Initializes the WPF component (`InitializeComponent()`), resolves the `IEventAggregator` service from `ContainerLocator.Container`, and stores it in the private field `_eventAggregator`. No parameters.
|
||||
|
||||
- **`CbFilterOption_LostFocus(object sender, RoutedEventArgs e)`**
|
||||
Private event handler (WPF `RoutedEventHandler`) attached to the `LostFocus` event of a UI element named `cbFilterOption` (presumably a `ComboBox`). When triggered, it attempts to parse the current text of `cbFilterOption` as a `double`. If successful, it publishes the parsed value (`freq`) via the `SensorSavedEvent` using the `_eventAggregator`.
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- The `SensorSettingsView` instance **must** be constructed after `ContainerLocator.Container` has been initialized with a registered `IEventAggregator` implementation; otherwise, resolution will fail.
|
||||
- The `cbFilterOption.Text` value is only published if it can be successfully parsed as a `double`; invalid or empty input results in no event being published.
|
||||
- The `freq` field is reused across invocations of `CbFilterOption_LostFocus`, but only the most recently parsed value is published.
|
||||
- The `SensorSavedEvent` is assumed to accept a `double` payload (based on usage), and its subscribers are responsible for interpreting and persisting the value.
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
**Imports / External Types Used:**
|
||||
- `DTS.Common.Events.Sensors.SensorsList.SensorSavedEvent` — event type used to publish the parsed frequency.
|
||||
- `DTS.Common.Interface.Sensors.SensorSettingsModule.ISensorSettingsView` — interface implemented by this class.
|
||||
- `Prism.Ioc.IContainerLocator` and `Prism.Events.IEventAggregator` — Prism framework services for dependency resolution and event aggregation.
|
||||
- `System.Windows` — WPF UI framework (e.g., `RoutedEventArgs`, `Window` base types).
|
||||
|
||||
**Assumed Dependencies (from usage):**
|
||||
- A WPF `ComboBox` named `cbFilterOption` must exist in the corresponding `SensorSettingsView.xaml` (not shown), with its `LostFocus` event wired to `CbFilterOption_LostFocus`.
|
||||
- `ContainerLocator.Container` must be set up with a registered `IEventAggregator` (standard Prism pattern).
|
||||
- At least one subscriber must exist for `SensorSavedEvent` to handle the published `double` value.
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **Race/State Issue**: The `freq` field is a class-level field reused across multiple `LostFocus` invocations. While harmless in this specific case (since only the latest value is published), it is unnecessary and could mislead maintainers. A local variable would be clearer.
|
||||
- **Parsing Behavior**: `double.TryParse` uses the current thread’s culture settings. If `cbFilterOption.Text` is user-entered and culture-sensitive (e.g., `"3.14"` vs `"3,14"`), parsing may fail unexpectedly on non-US locales unless UI or thread culture is explicitly normalized.
|
||||
- **Event Name Ambiguity**: `SensorSavedEvent` suggests persistence to a database, but the handler only publishes the value — it does not itself save to DB. The comment `//FB 13120 Identify the AdHoc filter to get saved later on if it's not already saved to db` implies downstream logic handles persistence, but this is not visible in the source.
|
||||
- **No Validation**: No explicit validation of the parsed frequency (e.g., range checks, non-negative constraints) is performed before publishing.
|
||||
- **No Null/Empty Handling**: If `cbFilterOption.Text` is null or whitespace, `TryParse` fails silently and no event is published — this may be intentional but is not documented.
|
||||
- **Tight Coupling to Prism**: Reliance on `ContainerLocator.Container` (a static locator) rather than constructor injection makes unit testing harder and violates modern DI best practices.
|
||||
@@ -0,0 +1,137 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorSettingsModule/ViewModel/SensorSettingsViewModel.cs
|
||||
generated_at: "2026-04-16T04:52:53.608461+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ee04bd3c1edeb80f"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
### **1. Purpose**
|
||||
The `SensorSettingsViewModel` class serves as the central view model for the Sensor Settings UI module, coordinating user interactions with various sensor configuration defaults (e.g., squib, digital output, analog, UART, CAN, IEPESensor, calibration policy, stream output). It implements Prism’s `INavigationAware`-like lifecycle methods (e.g., `OnSetActive`, `Unset`, `Cleanup`) to manage state when the view is activated or deactivated, and handles validation, persistence, and restoration of user-specific and global sensor defaults via dedicated default interfaces and database operations. It also mediates UI notifications (via `InteractionRequest`) and busy state via Prism’s `EventAggregator`.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
|
||||
#### **Constructor**
|
||||
```csharp
|
||||
public SensorSettingsViewModel(
|
||||
ISensorSettingsView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the view model by assigning the view, registering event subscriptions (`RaiseNotification`, `BusyIndicatorChangeNotification`), and storing dependencies. Sets `View.DataContext = this`.
|
||||
|
||||
#### **Lifecycle Methods**
|
||||
- `void OnSetActive()`
|
||||
Loads all sensor default settings (e.g., `SquibSettings`, `AnalogDefaults`, `UartIODefaults`) from their respective static default factories (e.g., `SquibSettingDefaults.GetSquibSettingsDefault(User)`) using the current `User`/`UserID`, and raises `PropertyChanged` for each property. Called when the view becomes active.
|
||||
|
||||
- `void Unset()`
|
||||
Invokes `ValidateAndSave()` to persist any pending changes before the view is deactivated.
|
||||
|
||||
- `void Cleanup()` / `Task CleanupAsync()` / `void Initialize()` / `void Initialize(object)` / `void Initialize(object, object)` / `Task InitializeAsync()` / `Task InitializeAsync(object)` / `void Activated()`
|
||||
No-op stubs; no implementation present in source.
|
||||
|
||||
#### **Public Methods**
|
||||
- `void RestoreOriginalSettings()`
|
||||
Resets all sensor default settings to their factory defaults using corresponding `RestoreDefaults()` methods (e.g., `AnalogSettingDefaults.RestoreDefaults(AnalogDefaults)`), then re-applies them via `Save()` or `CommitChange()` where applicable (e.g., `UartSettingDefaults.CommitChange(...)`), and raises `PropertyChanged` for modified properties.
|
||||
|
||||
- `bool ValidateAndSave()`
|
||||
Validates all sensor defaults via their `Validate()` methods, and persists valid changes to the database (e.g., `UartSettingDefaults.CommitChange(...)`, `IEPESensorDefault.Save(...)`, `CalibrationPolicy.WriteCalibrationPolicyToDb(...)`). If calibration policy changes, calls `InvalidateAllTestSetups()` to mark all test setups as dirty. Returns `true` only if *all* validations and saves succeed; catches exceptions and publishes `PageErrorEvent`.
|
||||
|
||||
- `void InvalidateAllTestSetups()`
|
||||
Executes raw SQL `UPDATE [TestSetups] SET [Dirty]=1, [Complete]=0` to invalidate all test setups when calibration policy changes.
|
||||
|
||||
#### **Properties**
|
||||
- `ISensorSettingsView View { get; set; }`
|
||||
Reference to the associated view.
|
||||
|
||||
- `IDigitalInputDefaults DigitalInputDefaults { get; set; }`
|
||||
- `ISquibSettingDefaults SquibSettings { get; set; }`
|
||||
- `IDigitalOutDefaults DigitalOutSettings { get; set; }`
|
||||
- `IIEPESensorDefaults IEPESensorDefaults { get; set; }`
|
||||
- `ICalibrationPolicy SensorCalibrationDefaults { get; set; }`
|
||||
- `IAnalogDefaults AnalogDefaults { get; set; }`
|
||||
- `IUartSettingDefaults UartIODefaults { get; set; }`
|
||||
- `ICanSettingDefaults CanIODefaults { get; set; }`
|
||||
- `IStreamOutputSettingDefaults StreamOutputSettings { get; set; }`
|
||||
Public properties holding current sensor configuration defaults (assigned in `OnSetActive()`).
|
||||
|
||||
- `string User { get; set; }`
|
||||
- `int UserID { get; set; }`
|
||||
User identity context used for user-specific defaults.
|
||||
|
||||
- `bool IsDirty => false`
|
||||
Always returns `false`; no dynamic dirty tracking implemented.
|
||||
|
||||
- `bool IsBusy { get; set; }`
|
||||
Bound to UI busy indicator; updated via `OnBusyIndicatorNotification`.
|
||||
|
||||
- `bool IsMenuIncluded { get; set; }`
|
||||
- `bool IsNavigationIncluded { get; set; }`
|
||||
UI layout flags; no usage logic beyond property change notification.
|
||||
|
||||
#### **Events & Requests**
|
||||
- `event PropertyChangedEventHandler PropertyChanged`
|
||||
Standard `INotifyPropertyChanged` implementation.
|
||||
|
||||
- `InteractionRequest<Notification> NotificationRequest { get; }`
|
||||
- `InteractionRequest<Confirmation> ConfirmationRequest { get; }`
|
||||
Prism `InteractionRequest` instances used to trigger modal notifications/confirmations.
|
||||
|
||||
#### **Private Event Handlers**
|
||||
- `void OnBusyIndicatorNotification(bool eventArg)`
|
||||
Updates `IsBusy` property.
|
||||
|
||||
- `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)`
|
||||
Converts `NotificationContentEventArgs` to `Notification` and raises `NotificationRequest`.
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- `User` and `UserID` must be set before `OnSetActive()` is called; otherwise, defaults may be loaded incorrectly or fail (e.g., `SquibSettingDefaults.GetSquibSettingsDefault(User)` uses `User`).
|
||||
- `ValidateAndSave()` requires all sensor default properties (`SquibSettings`, `AnalogDefaults`, etc.) to be non-null and of the correct concrete type (e.g., `SquibSettingDefaults`) to succeed; otherwise, it returns `false` early.
|
||||
- Calibration policy changes trigger `InvalidateAllTestSetups()`, marking all test setups as dirty and incomplete.
|
||||
- `IsDirty` is hardcoded to `false`; no actual dirty state tracking occurs.
|
||||
- `RestoreOriginalSettings()` and `ValidateAndSave()` perform database writes synchronously (no async/await).
|
||||
- `OnSetActive()` must be called before other methods that rely on initialized default properties (e.g., `ValidateAndSave()`).
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
|
||||
#### **Imports/Usings (External)**
|
||||
- `Prism.Events`, `Prism.Regions`, `Prism.Ioc` → Prism framework for event aggregation, region management, and container resolution.
|
||||
- `Unity` → Unity container (`IUnityContainer`).
|
||||
- `DTS.Common.*` → Internal libraries for events (`RaiseNotification`, `BusyIndicatorChangeNotification`, `PageErrorEvent`), interactivity (`InteractionRequest`), interfaces (`ISensorSettingsViewModel`, `IDigitalInputDefaults`, etc.), storage (`DbOperations`, `CalibrationPolicy`), and channel settings (`ChannelSettingBase`).
|
||||
- `DTS.SensorDB` → Database layer for defaults (e.g., `UartSettingDefaults`, `CalibrationPolicy`).
|
||||
|
||||
#### **Key Dependencies**
|
||||
- **Interfaces**: `ISensorSettingsView`, `IDigitalInputDefaults`, `ISquibSettingDefaults`, `IDigitalOutDefaults`, `IIEPESensorDefaults`, `ICalibrationPolicy`, `IAnalogDefaults`, `IUartSettingDefaults`, `ICanSettingDefaults`, `IStreamOutputSettingDefaults`.
|
||||
- **Static Classes/Methods**: `SquibSettingDefaults`, `DigitalOutputDefaults`, `AnalogSettingDefaults`, `UartSettingDefaults`, `StreamOutputSettingDefaults`, `CanSettingDefaults`, `IEPESensorDefault`, `DigitalInputSensorDefault`, `CalibrationPolicy`, `DbOperations`, `ChannelSettingBase`.
|
||||
- **Prism Abstractions**: `IEventAggregator`, `IRegionManager`, `IUnityContainer`, `InteractionRequest<T>`.
|
||||
|
||||
#### **Depended Upon By**
|
||||
- The view (`ISensorSettingsView`) binds to this view model (via `View.DataContext = this`).
|
||||
- Other modules likely publish `RaiseNotification`/`BusyIndicatorChangeNotification` events consumed here.
|
||||
- `PageErrorEvent` is published on exceptions, consumed by error-handling modules.
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **Hardcoded `IsDirty = false`**: The `IsDirty` property is constant and never reflects actual state changes, misleading UI or logic that relies on it.
|
||||
- **Type casting in `ValidateAndSave()`**: Uses pattern matching (`is T`) to cast interface properties to concrete types (e.g., `SquibSettings is SquibSettingDefaults squib`). If any property is not the expected concrete type, validation fails silently (returns `false`).
|
||||
- **Partial `ValidateAndSave()` failure**: If validation fails for *any* setting (e.g., UART), the method still attempts to validate/save other settings before returning `false`. No transactional rollback occurs.
|
||||
- **Calibration policy change detection**: Compares *all* fields of `CalibrationPolicy` manually; if new fields are added later, they won’t trigger `InvalidateAllTestSetups()`.
|
||||
- **`User`/`UserID` initialization**: No validation ensures `User`/`UserID` are set before `OnSetActive()`; defaults may load incorrectly or throw if `User` is `null`.
|
||||
- **Synchronous DB writes**: `ValidateAndSave()` and `RestoreOriginalSettings()` perform blocking database operations (e.g., `ExecuteNonQuery()`), risking UI freezes.
|
||||
- **`Cleanup()`/`CleanupAsync()` are empty**: No cleanup logic is implemented, potentially leaving resources or subscriptions unmanaged.
|
||||
- **`NotificationRequest` conversion**: `OnRaiseNotification` creates a new `NotificationContentEventArgs` with empty `SubTitle` and `Footer`; this may discard intended UI content.
|
||||
- **No async support in lifecycle methods**: `InitializeAsync`, `CleanupAsync` return `Task.CompletedTask`; no actual async work is performed.
|
||||
- **No error handling in `RestoreOriginalSettings()`**: Exceptions during restore (e.g., DB commit failures) are not caught or reported.
|
||||
|
||||
None identified beyond these.
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/SensorsListModule.cs
|
||||
generated_at: "2026-04-16T04:52:44.195014+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "281b61d00fb66791"
|
||||
---
|
||||
|
||||
# SensorsList
|
||||
|
||||
## Documentation: SensorsListModule
|
||||
|
||||
### 1. Purpose
|
||||
The `SensorsListModule` is a Prism module responsible for registering the view and view model types associated with the Sensors List UI component into the Unity dependency injection container. It enables modular composition of the application by exposing the `SensorsListView`, `SensorsListViewModel`, `SensorsListEditGroupView`, and `SensorsListEditGroupViewModel` as singleton services via their respective interfaces (`ISensorsListView`, `ISensorsListViewModel`, etc.). Additionally, the module contributes metadata (name, image, group, and region) to the host application’s module discovery and UI assembly system via assembly-level attributes (`SensorsListModuleNameAttribute`, `SensorsListModuleImageAttribute`), allowing the main screen to display and categorize this module.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`SensorsListModule` class**
|
||||
- `public SensorsListModule(IUnityContainer unityContainer)`
|
||||
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration.
|
||||
- `public void Initialize()`
|
||||
Registers four types as singletons in the Unity container:
|
||||
- `ISensorsListView` → `SensorsListView`
|
||||
- `ISensorsListViewModel` → `SensorsListViewModel`
|
||||
- `ISensorsListEditGroupView` → `SensorsListEditGroupView`
|
||||
- `ISensorsListEditGroupViewModel` → `SensorsListEditGroupViewModel`
|
||||
This method is called by `RegisterTypes`, and is also invoked directly during module initialization.
|
||||
- `public void OnInitialized(IContainerProvider containerProvider)`
|
||||
Currently empty; no logic is executed during Prism’s `OnInitialized` phase.
|
||||
- `public void RegisterTypes(IContainerRegistry containerRegistry)`
|
||||
Delegates to `Initialize()`, which uses the injected `IUnityContainer` (not `containerRegistry`). *Note: `containerRegistry` is unused.*
|
||||
|
||||
- **`SensorsListModuleNameAttribute` class**
|
||||
- `public override string AssemblyName { get; }`
|
||||
Returns `"SensorsList"` (from `AssemblyNames.SensorsList.ToString()`).
|
||||
- `public override Type GetAttributeType()`
|
||||
Returns `typeof(TextAttribute)`.
|
||||
- `public override string GetAssemblyName()`
|
||||
Returns the value of `AssemblyName`.
|
||||
|
||||
- **`SensorsListModuleImageAttribute` class**
|
||||
- `public override BitmapImage AssemblyImage { get; }`
|
||||
Returns the image loaded via `AssemblyInfo.GetImage("SensorsList")`.
|
||||
- `public override string AssemblyName { get; }`
|
||||
Returns `"SensorsList"`.
|
||||
- `public override string AssemblyGroup { get; }`
|
||||
Returns `"Prepare"` (from `eAssemblyGroups.Prepare.ToString()`).
|
||||
- `public override eAssemblyRegion AssemblyRegion { get; }`
|
||||
Returns `eAssemblyRegion.SensorsListRegion`.
|
||||
- `public override Type GetAttributeType()`
|
||||
Returns `typeof(ImageAttribute)`.
|
||||
- `public override BitmapImage GetAssemblyImage()`
|
||||
Returns `AssemblyImage`.
|
||||
- `public override string GetAssemblyName()`
|
||||
Returns `AssemblyName`.
|
||||
- `public override string GetAssemblyGroup()`
|
||||
Returns `AssemblyGroup`.
|
||||
- `public override eAssemblyRegion GetAssemblyRegion()`
|
||||
Returns `AssemblyRegion`.
|
||||
|
||||
### 3. Invariants
|
||||
- The module must be loaded *after* the Unity container is available (via Prism’s module loading mechanism).
|
||||
- The `SensorsListModuleNameAttribute` and `SensorsListModuleImageAttribute` must be applied at the assembly level (enforced via `[assembly: ...]` directives).
|
||||
- The `AssemblyNames.SensorsList` enum value and `eAssemblyGroups.Prepare`, `eAssemblyRegion.SensorsListRegion` must be defined elsewhere (not in this file); their values are assumed constant.
|
||||
- All registered types (`SensorsListView`, `SensorsListViewModel`, etc.) must have parameterless constructors or be resolvable by Unity (no explicit constructor injection is declared for them here).
|
||||
- `Initialize()` is called *exactly once* per module instance, during `RegisterTypes`.
|
||||
|
||||
### 4. Dependencies
|
||||
**Dependencies *of* this module:**
|
||||
- `DTS.Common` and `DTS.Common.Interface` (specifically `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`)
|
||||
- `Prism.Modularity` (`IModule`, `ModuleAttribute`)
|
||||
- `Prism.Ioc` (`IContainerProvider`, `IContainerRegistry`)
|
||||
- `Unity` (`IUnityContainer`)
|
||||
- `System.Windows.Media.Imaging` (for `BitmapImage`)
|
||||
|
||||
**Dependencies *on* this module:**
|
||||
- The host application (or other modules) that consumes the registered views/view models via `ISensorsListView`, `ISensorsListViewModel`, etc.
|
||||
- UI composition logic that relies on `SensorsListModuleImageAttribute` metadata to render module icons and groupings in the main screen.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Unused parameter in `RegisterTypes`**: The `IContainerRegistry containerRegistry` parameter is ignored; the method uses the pre-injected `_unityContainer` instead. This may cause confusion if Prism’s `RegisterTypes` is expected to use `containerRegistry`.
|
||||
- **Redundant `Initialize()` call**: `Initialize()` is invoked both directly in the constructor’s usage path and via `RegisterTypes`, but since it’s idempotent (only performs registrations), this is safe. Still, it’s non-standard Prism pattern (typically `RegisterTypes` uses `containerRegistry`, and `OnInitialized` handles post-registration setup).
|
||||
- **No error handling**: If `AssemblyInfo.GetImage("SensorsList")` fails (e.g., missing image resource), the attribute constructors will throw at assembly load time (not lazily), potentially breaking module discovery.
|
||||
- **Attribute constructors perform side effects**: `SensorsListModuleImageAttribute`’s constructor calls `AssemblyInfo.GetImage(...)`, which may involve I/O or resource loading. This happens at assembly load time, not module initialization time.
|
||||
- **No documentation on view/view model lifetimes beyond "singleton"**: While Unity registration implies singleton, Prism’s `IContainerRegistry` typically uses `ContainerControlledLifetimeManager` for singletons — but here the `IUnityContainer` is used directly, so behavior depends on Unity’s default registration semantics (which *are* singleton unless overridden).
|
||||
- **No usage of `IContainerProvider` in `OnInitialized`**: The method is empty, suggesting incomplete implementation or future extensibility.
|
||||
@@ -0,0 +1,180 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/DigitalOutputSetting.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/StreamInputSetting.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/CanIOSetting.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/UartIOSetting.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/DigitalInputSetting.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/Squib.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Model/StreamOutputSetting.cs
|
||||
generated_at: "2026-04-16T04:54:46.120628+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "68d6854c20dea988"
|
||||
---
|
||||
|
||||
# SensorsList.Model Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data models for representing various sensor and I/O configuration types within the SensorsList UI component of the DataPRO system. Each class wraps low-level database records or sensor data (`ISensorData`, `ICANRecord`, `IUARTRecord`, `IDigitalOutDbRecord`, `IDigitalInDbRecord`, `ISquibDbRecord`) into UI-friendly view models that support property change notifications, filtering, sorting, and drag-and-drop operations. These models serve as the data layer for UI lists where users configure digital inputs/outputs, CAN, UART, stream input/output, and squib channels—enabling consistent behavior across different sensor types while abstracting underlying data sources.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DigitalOutputSetting`
|
||||
- **`bool Included { get; set; }`** – Controls whether the item is included (checked) in UI lists.
|
||||
- **`string Description { get; set; }`** – Human-readable description; initialized from `ISensorData.Comment`.
|
||||
- **`bool Disabled { get; set; }`** – UI state flag (not actively used per source).
|
||||
- **`bool Assigned { get; set; }`** – Whether the output is assigned to a channel.
|
||||
- **`bool Online { get; set; }`** – Whether the output is currently online.
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `DODelay`, or `DODuration` (converted to string via `CultureInfo.CurrentCulture`) contains the lowercase `term`.
|
||||
- **Constructors**:
|
||||
- `DigitalOutputSetting()` – Default.
|
||||
- `DigitalOutputSetting(IDigitalOutDbRecord record)` – Initializes base class from record.
|
||||
- `DigitalOutputSetting(ISensorData s)` – Maps properties from `ISensorData` (e.g., `DODelay = s.DigitalOutputDelayMS`, `DODuration = s.DigitalOutputDurationMS`, `DOMode = s.DigitalOutputMode`).
|
||||
- **`bool IsTestSpecificDigitalOutput()`** – Returns `true` if `SerialNumber` starts with `"TSD_"`.
|
||||
|
||||
### `DigitalOutComparer`
|
||||
- **`DigitalOutFields SortField { get; set; }`** – Field to sort by.
|
||||
- **`bool SortAscending { get; set; }`** – Sort direction.
|
||||
- **`int Compare(IDigitalOutputSetting left, IDigitalOutputSetting right)`** – Compares two items based on `SortField`. Supports: `Included`, `SerialNumber`, `Description`, `Delay` (`DODelay`), `Duration` (`DODuration`), `ModifiedBy`, `LastModified`. Uses `StringComparison.OrdinalIgnoreCase` for strings.
|
||||
|
||||
---
|
||||
|
||||
### `StreamInputSetting`
|
||||
- **`bool Included { get; set; }`** – Included state.
|
||||
- **`string SerialNumber { get; set; }`** – Unique identifier.
|
||||
- **`string Description { get; set; }`** – Description/comment.
|
||||
- **`string LastModifiedBy { get; set; }`**, **`DateTime LastModified { get; set; }`** – Audit metadata.
|
||||
- **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`** – Assignment/online status.
|
||||
- **`int DatabaseId { get; set; }`** – Database record ID (default `-1`).
|
||||
- **`string UDPAddress { get; set; }`** – UDP endpoint (default `"UDP://239.1.2.10:8400"`).
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, or `UDPAddress` (lowercased) contains `term`.
|
||||
- **Constructors**:
|
||||
- `StreamInputSetting()` – Default.
|
||||
- `StreamInputSetting(ISensorData s)` – Maps `s.StreamInUDPAddress` to `UDPAddress`.
|
||||
- **`bool IsTestSpecificStreamInput()`** – Returns `true` if `SerialNumber` starts with `"TSS_"`.
|
||||
|
||||
### `StreamInComparer`
|
||||
- **`StreamInSettingFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(IStreamInputSetting left, IStreamInputSetting right)`** – Supports: `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPAddress`. Uses `StringComparison.OrdinalIgnoreCase`.
|
||||
|
||||
---
|
||||
|
||||
### `CanIOSetting`
|
||||
- **`bool Included { get; set; }`**
|
||||
- **`string SerialNumber { get; set; }`**, **`string Description { get; set; }`**, **`int DatabaseId { get; set; }`**, **`string LastModifiedBy { get; set; }`**, **`DateTime LastModified { get; set; }`**
|
||||
- **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`**, **`bool Broken { get; set; }`**, **`bool DoNotUse { get; set; }`**
|
||||
- **`bool CanIsFD { get; set; }`**, **`int CanArbBaseBitrate { get; set; }`**, **`int CanArbBaseSJW { get; set; }`**, **`int CanDataBitrate { get; set; }`**, **`int CanDataSJW { get; set; }`**, **`string CanFileType { get; set; }`**
|
||||
- **`string ISOCode { get; set; }`**, **`string ISOChannelName { get; set; }`**, **`string UserCode { get; set; }`**, **`string UserChannelName { get; set; }`**
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, `CanIsFD`, `CanArbBaseBitrate`, `CanArbBaseSJW`, `CanDataBitrate`, `CanDataSJW`, or `CanFileType` (lowercased, using `CultureInfo.CurrentCulture` for numbers) contains `term`.
|
||||
- **Constructors**:
|
||||
- `CanIOSetting()` – Default.
|
||||
- `CanIOSetting(ICANRecord record)` – Initializes from `ICANRecord`.
|
||||
- `CanIOSetting(ISensorData s)` – Initializes from `ISensorData` (e.g., `CanIsFD = s.CanIsFD`).
|
||||
- **No `IsTestSpecific...` helper** (not present in source).
|
||||
|
||||
### `CanIOComparer`
|
||||
- **`CanSettingFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(ICanIOSetting left, ICanIOSetting right)`** – Uses `DTS.Common.Utilities.NaturalStringComparer` for string fields. Supports: `CanIsFD`, `CanArbBaseBitrate`, `CanArbBaseSJW`, `CanDataBitrate`, `CanDataSJW`, `CanFileType`. Throws `ArgumentOutOfRangeException` for unsupported fields.
|
||||
|
||||
---
|
||||
|
||||
### `UartIOSetting`
|
||||
- **`bool Included { get; set; }`**
|
||||
- **`string SerialNumber { get; set; }`**, **`string Description { get; set; }`**, **`int DatabaseId { get; set; }`**, **`string LastModifiedBy { get; set; }`**, **`DateTime LastModified { get; set; }`**
|
||||
- **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`**, **`bool Broken { get; set; }`**, **`bool DoNotUse { get; set; }`**
|
||||
- **`uint BaudRate { get; set; } = 57600`**, **`uint DataBits { get; set; } = 8`**, **`StopBits StopBits { get; set; } = StopBits.None`**, **`Parity Parity { get; set; } = Parity.None`**, **`Handshake FlowControl { get; } = Handshake.None`** (hardcoded to `None`; comment references FB 30486).
|
||||
- **`UartDataFormat DataFormat { get; set; } = UartDataFormat.Binary`**
|
||||
- **`string ISOCode { get; set; }`**, **`string ISOChannelName { get; set; }`**, **`string UserCode { get; set; }`**, **`string UserChannelName { get; set; }`**
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, or `DataFormat` (lowercased) contains `term`.
|
||||
- **Constructors**:
|
||||
- `UartIOSetting()` – Default.
|
||||
- `UartIOSetting(IUARTRecord record)` – Initializes from `IUARTRecord`.
|
||||
- `UartIOSetting(ISensorData s)` – Initializes from `ISensorData`.
|
||||
- **No `IsTestSpecific...` helper**.
|
||||
|
||||
### `UartIOComparer`
|
||||
- **`UartSettingFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(IUartIOSetting left, IUartIOSetting right)`** – Uses `NaturalStringComparer` for strings. Supports: `Included`, `SerialNumber`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, `DataFormat`, `LastModifiedBy`, `LastModified`.
|
||||
|
||||
---
|
||||
|
||||
### `DigitalInputSetting`
|
||||
- **Inherits from `DigitalInDbRecord`** (base class provides `Id`, `Mode`, `ScaleMultiplier`, `UserValue1`, `LastModifiedBy`, `SerialNumber`, `EID`).
|
||||
- **`bool Included { get; set; }`**
|
||||
- **`string Description { get; set; }`** – Gets/sets `UserValue1`.
|
||||
- **`string DIMode { get; set; }`** – Gets/sets `Mode` enum as string (via `Enum.TryParse`).
|
||||
- **`string ModifiedBy { get; set; }`** – Gets/sets `LastModifiedBy`.
|
||||
- **`bool Disabled { get; set; }`**, **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`**
|
||||
- **`int DatabaseId { get; set; }`** – Gets/sets `Id`.
|
||||
- **`string ActiveValue { get; set; }`** – Gets/sets `ScaleMultiplier.ActiveValue` as string (parsed via `double.TryParse`).
|
||||
- **`string DefaultValue { get; set; }`** – Gets/sets `ScaleMultiplier.DefaultValue` as string.
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, or `DIMode` (lowercased) contains `term`.
|
||||
- **Constructors**:
|
||||
- `DigitalInputSetting()` – Default.
|
||||
- `DigitalInputSetting(IDigitalInDbRecord record)` – Base constructor.
|
||||
- `DigitalInputSetting(ISensorData s)` – Maps `s.InputMode`, `s.InputActiveValue`, `s.InputDefaultValue`, etc.
|
||||
- **`bool IsTestSpecificDigitalInput()`** – Returns `true` if `SerialNumber` starts with `"TSI_"`.
|
||||
|
||||
### `DigitalInComparer`
|
||||
- **`DigitalInputFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(IDigitalInputSetting left, IDigitalInputSetting right)`** – Uses `NaturalStringComparer` for strings. Supports: `Included`, `SerialNumber`, `Description`, `Mode`, `ModifiedBy`, `LastModified`.
|
||||
|
||||
---
|
||||
|
||||
### `Squib`
|
||||
- **Inherits from `SquibDbRecord`** (base class provides `Id`, `ArticleId`, `FireMode`, `DelayMs`, `DurationMs`, `SquibOutputCurrent`, `SquibToleranceLow`, `SquibToleranceHigh`, `LastModifiedBy`, `IsoCode`, `IsoChannelName`, `SerialNumber`).
|
||||
- **`bool Included { get; set; }`**
|
||||
- **`string Description { get; set; }`** – Gets/sets `UserValue1`.
|
||||
- **`double ResistanceLow { get; set; }`**, **`double ResistanceHigh { get; set; }`** – Wrappers for `SquibToleranceLow`/`High`.
|
||||
- **`string ID { get; set; }`** – Wraps `ArticleId`.
|
||||
- **`string SQMode { get; set; }`** – Wraps `FireMode` enum as string.
|
||||
- **`double SQDelay { get; set; }`**, **`double SQCurrent { get; set; }`**, **`double SQDuration { get; set; }`** – Wrappers for `DelayMs`, `SquibOutputCurrent`, `DurationMs`.
|
||||
- **`string ModifiedBy { get; set; }`** – Wraps `LastModifiedBy`.
|
||||
- **`bool Disabled { get; set; }`**, **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`**
|
||||
- **`int DatabaseId { get; set; }`** – Wraps `Id`.
|
||||
- **`string ISOCode { get; set; }`**, **`string ISOChannelName { get; set; }`** – Wrappers for `IsoCode`/`IsoChannelName`.
|
||||
- **`SquibFireMode Mode { get; set; }`** – Wraps `FireMode`.
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, `SQDelay`, `SQCurrent`, `SQDuration`, or `SQMode` (lowercased) contains `term`.
|
||||
- **Constructors**:
|
||||
- `Squib()` – Default.
|
||||
- `Squib(ISquibDbRecord record)` – Base constructor.
|
||||
- `Squib(ISensorData s)` – Maps `s.SquibFireDelayMS`, `s.SquibOutputCurrent`, `s.SquibFireDurationMS`, `s.SquibToleranceHigh`, `s.SquibToleranceLow`, `s.EID`, etc.
|
||||
- **`bool IsTestSpecificSquib()`** – Returns `true` if `SerialNumber` starts with `"TSQ_"`.
|
||||
|
||||
### `SquibComparer`
|
||||
- **`SquibFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(ISquib left, ISquib right)`** – Uses `NaturalStringComparer` for strings. Supports: `Included`, `SerialNumber`, `Description`, `ResistanceLow`, `ResistanceHigh`, `Id`, `Mode`, `Delay`, `Current`, `Duration`, `ModifiedBy`, `LastModified`.
|
||||
|
||||
---
|
||||
|
||||
### `StreamOutputSetting`
|
||||
- **`bool Included { get; set; }`**
|
||||
- **`string SerialNumber { get; set; }`**, **`string Description { get; set; }`**, **`string LastModifiedBy { get; set; }`**, **`DateTime LastModified { get; set; }`**
|
||||
- **`bool Assigned { get; set; }`**, **`bool Online { get; set; }`**, **`bool Broken { get; set; }`**, **`bool DoNotUse { get; set; }`**
|
||||
- **`int DatabaseId { get; set; }`**
|
||||
- **`UDPStreamProfile UDPProfile { get; set; } = UDPStreamProfile.CH10_PCM_128BIT_2HDR`**
|
||||
- **`string UDPAddress { get; set; } = "UDP://239.1.2.10:8400"`**
|
||||
- **`ushort UDPTimeChannelId { get; set; } = 1`**, **`ushort UDPDataChannelId { get; set; } = 3`**
|
||||
- **`string UDPTmNSConfig { get; set; } = "(1,6,60,0,0,0,0,0)"`**
|
||||
- **`ushort IRIGTimeDataPacketIntervalMs { get; set; } = 500`**
|
||||
- **`ushort TMATSIntervalMs { get; set; } = StreamOutputRecord.DEFAULT_TMATS_INTERVAL_MS`**
|
||||
- **`bool Filter(string term)`** – Returns `true` if `SerialNumber`, `Description`, `UDPProfile`, `UDPAddress`, `UDPTimeChannelId`, `UDPDataChannelId`, `UDPTmNSConfig`, `IRIGTimeDataPacketIntervalMs`, or `TMATSIntervalMs` (lowercased) contains `term`.
|
||||
- **Constructors**:
|
||||
- `StreamOutputSetting()` – Default.
|
||||
- `StreamOutputSetting(ISensorData s)` – Maps all stream output properties from `ISensorData`.
|
||||
- **`bool IsTestSpecificStreamOutput()`** – Returns `true` if `SerialNumber` starts with `"TSS_"`.
|
||||
- **`bool IsCH10`, `bool IsTMNS`, `bool IsIENA`, `bool IsUART`** – Derived from `UDPProfile` via `TMNSConfig` static methods.
|
||||
- **`uint TMNS_SubFrameId { get; set; }`**, **`uint TMNS_MsgId { get; set; }`**, **`uint TMNS_MinorPerMajor { get; set; }`**, **`uint TMNS_TMATSPort { get; set; }`**, **`ushort IENA_Key { get; set; }`**, **`uint IENA_SourcePort { get; set; }`** – All parse/set `UDPTmNSConfig` using `TMNSConfig` class (e.g., `new TMNSConfig(UDPTmNSConfig).TMNS_PCMSubFrameId`).
|
||||
|
||||
### `StreamOutComparer`
|
||||
- **`StreamOutSettingFields SortField { get; set; }`**, **`bool SortAscending { get; set; }`**
|
||||
- **`int Compare(IStreamOutputSetting left, IStreamOutputSetting right)`** – Supports: `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPProfile`, `UDPAddress`, `UDPTimeChannelId`, `UDPDataChannelId`, `UDPTmNSConfig`, `IRIGTimeDataPacketIntervalMs`, `TMATSIntervalMs`. Uses `StringComparison.OrdinalIgnoreCase`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`Included`** is always initialized to `true` and is the only property exposed via `SetProperty` (for `DigitalOutputSetting`, `DigitalInputSetting`, `Squib`, `StreamInputSetting`, `StreamOutputSetting`, `CanIOSetting`, `UartIOSetting`).
|
||||
- **`DatabaseId`** is initialized to `-1` for `StreamInputSetting`, `Stream
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Properties/Settings.Designer.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:53:55.196453+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "239a12f47db4f8db"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## Documentation Page: `SensorsList.Properties.Settings`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module defines the application settings infrastructure for the `SensorsList` module within the DataPRO system. Specifically, it exposes a strongly-typed, thread-safe singleton wrapper (`Settings.Default`) for accessing application-level configuration values stored in the standard .NET `ApplicationSettingsBase` infrastructure (e.g., `app.config` or user-scoped settings). It serves as the canonical access point for runtime configuration related to sensor list behavior, though the actual settings keys and values are not defined in the provided source files and must be defined elsewhere (e.g., in `Settings.settings` designer file or `app.config`).
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
- **`Settings.Default`**
|
||||
- **Type**: `static Settings`
|
||||
- **Signature**: `public static Settings Default { get; }`
|
||||
- **Behavior**: Returns the singleton instance of the `Settings` class. This instance is synchronized (thread-safe via `ApplicationSettingsBase.Synchronized`) and provides access to all application/user settings defined for the module. *Note: No specific settings properties are declared in this file; they are auto-generated from `Settings.settings` and not visible here.*
|
||||
|
||||
- **`Settings` class**
|
||||
- **Type**: `internal sealed partial class` inheriting from `System.Configuration.ApplicationSettingsBase`
|
||||
- **Behavior**: A generated, strongly-typed settings class. While its members (e.g., `string SensorListRefreshInterval`, `bool EnableLogging`) are not visible in this source, they are auto-generated at build time based on the `Settings.settings` designer file. The class itself is `internal`, meaning it is only accessible within the `SensorsList` assembly.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- The `Settings` class is **sealed** and **internal**, preventing external inheritance or instantiation.
|
||||
- The `Default` property always returns the same singleton instance (initialized once via `Synchronized(new Settings())`), ensuring consistent access to settings across threads.
|
||||
- Thread safety is guaranteed *at the instance level* via `ApplicationSettingsBase.Synchronized`, but **not** for compound operations (e.g., read-modify-write sequences on settings values require external synchronization).
|
||||
- Settings values are persisted and loaded via the .NET configuration system (`System.Configuration`), relying on standard `app.config`/`user.config` file semantics.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Depends on**:
|
||||
- `System.Configuration` (for `ApplicationSettingsBase`)
|
||||
- `System.Runtime.CompilerServices` (for `[CompilerGenerated]`)
|
||||
- `System.CodeDom.Compiler` (for `[GeneratedCode]`)
|
||||
- `System.Runtime.InteropServices` (via `AssemblyInfo.cs` for COM interop attributes)
|
||||
|
||||
- **Depended on by**:
|
||||
- Other modules/classes within the `SensorsList` assembly (e.g., UI or logic components needing runtime configuration).
|
||||
- *Not directly consumed by external assemblies* due to `internal` visibility of `Settings`.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **No settings are defined in this file** — the actual settings properties (names, types, defaults) are auto-generated from `Properties/Settings.settings` (not provided). Developers must inspect that file or the compiled `app.config` to determine available settings.
|
||||
- The `Settings` class is `internal` — external modules cannot reference it directly. Settings must be consumed *within* the `SensorsList` module only.
|
||||
- The `defaultInstance` is initialized once at class load time; changes to configuration files at runtime will not be reflected until the application restarts or `Settings.Default.Reload()` is called (though `Reload()` is not visible here and may not be implemented).
|
||||
- The `[GeneratedCode]` attribute warns that manual edits will be overwritten — **do not modify this file**.
|
||||
- Thread safety applies only to individual property reads/writes; concurrent modifications to multiple settings require external locking.
|
||||
|
||||
> **Note**: No settings values, default values, or property names are discernible from the provided source. This documentation reflects only the structure and semantics visible in the given files.
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:53:55.041323+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f83cacf717afc61a"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Module
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides a WPF `MarkupExtension` (`TranslateExtension`) to enable localized string resolution directly in XAML. It acts as a bridge between the UI layer and the application’s resource system (`StringResources`), allowing developers to bind UI text elements (e.g., labels, headers) to culture-specific strings defined in `.resx` resources. Its role is to simplify internationalization by enabling declarative localization in XAML without requiring code-behind or view-model boilerplate.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `TranslateExtension` class
|
||||
*Namespace:* `SensorsList`
|
||||
*Base:* `System.Windows.Markup.MarkupExtension`
|
||||
*Attribute:* `[MarkupExtensionReturnType(typeof(string))]`
|
||||
|
||||
- **Constructor**
|
||||
```csharp
|
||||
public TranslateExtension(string key)
|
||||
```
|
||||
- **Behavior:** Initializes the extension with a resource key (`_key`).
|
||||
- **Constraints:** `key` must be a non-null, non-empty string to resolve a value; otherwise, a fallback is used (see *Invariants*).
|
||||
|
||||
- **`ProvideValue` method**
|
||||
```csharp
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
```
|
||||
- **Behavior:**
|
||||
- If `_key` is `null` or empty → returns `"#stringnotfound#"`.
|
||||
- Otherwise, attempts to retrieve the string from `StringResources.ResourceManager.GetString(_key)`.
|
||||
- If found → returns the localized string.
|
||||
- If not found (`null`) → returns `"#stringnotfound# <key>"` (e.g., `"#stringnotfound# MyKey"`).
|
||||
- **Note:** The `serviceProvider` parameter is unused in the implementation.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Resource key handling:**
|
||||
- Empty or `null` keys are explicitly handled and never cause exceptions.
|
||||
- Missing keys are *never* silently ignored; they produce a visible placeholder string (`#stringnotfound# <key>`).
|
||||
- **Return type:**
|
||||
- Always returns a `string` (as indicated by `[MarkupExtensionReturnType(typeof(string))]`).
|
||||
- **Thread safety:**
|
||||
- Relies on `StringResources.ResourceManager`, which is thread-safe per .NET documentation for `ResourceManager.GetString`.
|
||||
- **No side effects:**
|
||||
- `ProvideValue` is pure—no state mutation, no I/O, no logging.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Internal Dependencies**
|
||||
- `SensorsList.Resources.StringResources`:
|
||||
- Used via `StringResources.ResourceManager` to resolve localized strings.
|
||||
- `StringResources` is auto-generated from `.resx` files (e.g., `StringResources.resx`).
|
||||
- The assembly must contain the embedded resource `"SensorsList.Resources.StringResources"` for `ResourceManager` initialization to succeed.
|
||||
|
||||
#### **External Dependencies**
|
||||
- `System.Windows.Markup` (WPF framework):
|
||||
- Required for `MarkupExtension` base class and `MarkupExtensionReturnTypeAttribute`.
|
||||
- `System` (core libraries):
|
||||
- For `string.IsNullOrEmpty`, `ResourceManager`, `CultureInfo`, etc.
|
||||
|
||||
#### **Dependents**
|
||||
- XAML files in the `SensorsList` module (e.g., `*.xaml` pages, user controls) likely use this extension in bindings like:
|
||||
```xaml
|
||||
<TextBlock Text="{l:Translate Description}" />
|
||||
```
|
||||
where `l` is mapped to the `SensorsList` namespace.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Hardcoded placeholder string:**
|
||||
The `NotFound` constant (`"#stringnotfound#"`) is used verbatim. If this string appears in UI text, it may be indistinguishable from a missing translation. Consider documenting this as a convention for identifying missing keys during testing.
|
||||
- **No caching of resolved values:**
|
||||
`ProvideValue` is called per XAML binding evaluation (e.g., on initial load, culture changes). While `StringResources.ResourceManager` caches internally, repeated calls for the same key may occur if bindings re-evaluate.
|
||||
- **Culture switching:**
|
||||
Localization updates depend on `StringResources.Culture` being set appropriately *before* XAML is parsed. If the UI thread’s `CurrentUICulture` changes after initialization, bindings using `TranslateExtension` may not refresh unless the framework re-evaluates the extension (behavior depends on WPF binding mode).
|
||||
- **No validation of key existence:**
|
||||
The extension does not validate whether `_key` corresponds to an actual resource entry (e.g., `"Analog"`, `"ID"`). Typos in keys (e.g., `"Descripton"` instead of `"Description"`) will silently fall back to `#stringnotfound#`.
|
||||
- **Auto-generated resource class:**
|
||||
`StringResources.Designer.cs` is auto-generated. Manual edits will be overwritten. Add new keys only via `.resx` files and rebuild.
|
||||
- **No support for parameterized strings:**
|
||||
The extension only supports simple key lookups. It does not handle `string.Format`-style placeholders (e.g., `"Hello {0}"`). Such cases must be resolved in code-behind or view models.
|
||||
|
||||
*None identified beyond the above.*
|
||||
@@ -0,0 +1,155 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/View/SensorTemplatesImportView.xaml.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/View/SensorTemplatesExportView.xaml.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/View/SensorsListOverdueView.xaml.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/View/SensorsListView.xaml.cs
|
||||
- DataPRO/Modules/SensorsList/SensorsList/View/SensorsListEditGroupView.xaml.cs
|
||||
generated_at: "2026-04-16T04:54:32.304966+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7a0bb2e07792e0f5"
|
||||
---
|
||||
|
||||
# SensorsList View Layer Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the WPF UI view layer for the SensorsList feature, implementing views for displaying, filtering, sorting, and editing sensor data across multiple tabular views: main sensor list, overdue sensors, template import/export, and group editing. It acts as a thin presentation layer that binds to corresponding view models (`ISensorsListViewModel`, `ISensorsListOverdueView`, `ISensorsListEditGroupViewModel`, `ISensorTemplatesImportView`, `ISensorTemplatesExportView`) and handles UI-specific behaviors such as column visibility toggling, search/filtering via column headers, sorting, and drag-and-drop operations. The views are tightly coupled to XAML-defined UI structures and rely on WPF-specific event handlers to delegate logic to view models.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `SensorTemplatesImportView`
|
||||
- **`SensorTemplatesImportView()`**
|
||||
Constructor. Calls `InitializeComponent()` to wire up XAML-defined UI elements. Implements `ISensorTemplatesImportView`.
|
||||
|
||||
### `SensorTemplatesExportView`
|
||||
- **`SensorTemplatesExportView()`**
|
||||
Constructor. Calls `InitializeComponent()`. Implements `ISensorTemplatesExportView`.
|
||||
|
||||
### `SensorsListOverdueView`
|
||||
- **`SensorsListOverdueView()`**
|
||||
Constructor. Calls `InitializeComponent()`. Implements `ISensorsListOverdueView`.
|
||||
- **`ListViewHeader_Click(object sender, RoutedEventArgs e)`**
|
||||
Handles column header clicks for sorting overdue items. Extracts `Tag` from the clicked header and calls `viewModel.SortOverdue(tag, true)`.
|
||||
- **`GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)`**
|
||||
Handles search input from column headers. Extracts `searchTerm` from `e.OriginalSource` and `columnTag` from the header’s `Tag`. Contains placeholder comment `// Do search` but no implementation.
|
||||
|
||||
### `SensorsListView`
|
||||
- **`SensorsListView()`**
|
||||
Constructor. Calls `InitializeComponent()`. Implements `ISensorsListView`.
|
||||
- **`SetIncludedVisible(bool bUsesIncludeColumn)`**
|
||||
Dynamically adds/removes the “Included” column across all sub-ListViews (`ListView_SensorsListView`, `ListView_Squib`, etc.) based on `bUsesIncludeColumn`. Inserts/removes at index 0.
|
||||
- **`HandleColumns(CalibrationBehaviors calibrationBehavior)`**
|
||||
Adjusts column visibility based on calibration behavior:
|
||||
- For `LinearIfAvailable` or `NonLinearIfAvailable`: calls `RemoveAddedLinearColumn()`.
|
||||
- For `UseBothIfAvailable`: calls `AddAddedLinearColumn()`.
|
||||
- Also conditionally adds/removes the “First Use” column based on `SensorConstants.UseSensorFirstUseDate`.
|
||||
- **`HandleInspectBeforeUseVisibilityColumn(bool show)`**
|
||||
Adds or removes the `InspectBeforeUseColumn` based on `show`.
|
||||
- **`HandleAssemblyVisibilityColumns(bool bDontAllowDataCollectionIfOverused)`**
|
||||
Adds/removes `AssemblyColumn`, `UsageCountColumn`, and `MaximumUsageColumn` depending on `bDontAllowDataCollectionIfOverused`.
|
||||
|
||||
#### Filter/Sort Event Handlers (all delegate to `ISensorsListViewModel` methods):
|
||||
- **`GridViewColumnHeaderSearchable_OnSearch(...)`** → `viewModel.Filter(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableSquib_OnSearch(...)`** → `viewModel.FilterSquib(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableDigitalIn_OnSearch(...)`** → `viewModel.FilterDigitalIn(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableDigitalOut_OnSearch(...)`** → `viewModel.FilterDigitalOut(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableUart_OnSearch(...)`** → `viewModel.FilterUartIO(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableStreamIn_OnSearch(...)`** → `viewModel.FilterStreamIn(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableStreamOut_OnSearch(...)`** → `viewModel.FilterStreamOut(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeader_OnClick(...)`** → `viewModel.Sort(columnTag, true)`
|
||||
- **`GridViewColumnHeaderCheckBox_OnClick(...)`** → `viewModel.Sort(columnTag, true)`
|
||||
- **`CheckBox_Filter(object sender, RoutedEventArgs e)`**
|
||||
Converts `"All"` to `null` and calls `viewModel.Filter(columnTag, searchTerm)`.
|
||||
|
||||
#### Private Column Management Helpers (used internally by public methods):
|
||||
- `AddFirstUseColumn()`, `RemoveFirstUseColumn()`
|
||||
- `AddAddedLinearColumn()`, `RemoveAddedLinearColumn()`
|
||||
(Modifies `SensitivityHeader.HeaderTitle` and inserts/removes `AddedSensitivityColumn` after `SensitivityColumn`)
|
||||
- `AddInspectBeforeUseColumn()`, `RemoveInspectBeforeUseColumn()`
|
||||
- `AddAssemblyColumn()`, `RemoveAssemblyColumn()`
|
||||
- `AddUsageCountColumn()`, `RemoveUsageCountColumn()`
|
||||
- `AddMaximumUsageColumn()`, `RemoveMaximumUsageColumn()`
|
||||
|
||||
### `SensorsListEditGroupView`
|
||||
- **`SensorsListEditGroupView()`**
|
||||
Constructor. Calls `InitializeComponent()` and subscribes to `ListViewStatusEvent` via `IEventAggregator`.
|
||||
- **`HandleColumns()`**
|
||||
Conditionally adds/removes `FirstUseColumn` based on `SensorConstants.UseSensorFirstUseDate`.
|
||||
- **`HandleInspectBeforeUseVisibilityColumn(bool show)`**
|
||||
Adds/removes `InspectBeforeUseColumn`.
|
||||
- **`HandleAssemblyVisibilityColumns(bool bDontAllowDataCollectionIfOverused)`**
|
||||
Adds/removes `AssemblyColumn`, `UsageCountColumn`, `MaximumUsageColumn`.
|
||||
|
||||
#### Filter/Sort Event Handlers (all delegate to `ISensorsListEditGroupViewModel` methods):
|
||||
- **`GridViewColumnHeaderSearchable_OnSearch(...)`** → `viewModel.Filter(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableSquib_OnSearch(...)`** → `viewModel.FilterSquib(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableDigitalIn_OnSearch(...)`** → `viewModel.FilterDigitalIn(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableDigitalOut_OnSearch(...)`** → `viewModel.FilterDigitalOut(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableUart_OnSearch(...)`** → `viewModel.FilterUartIO(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableStreamIn_OnSearch(...)`** → `viewModel.FilterStreamIn(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeaderSearchableStreamOut_OnSearch(...)`** → `viewModel.FilterStreamOut(columnTag, searchTerm)`
|
||||
- **`GridViewColumnHeader_OnClick(...)`**
|
||||
Handles header clicks, including fallback via `Utils.FindChild<GridViewColumnHeaderSearchable>`. Skips `GridViewColumnHeaderSearchableCheckBox` headers to avoid duplicate sorting.
|
||||
- **`GridViewColumnHeaderCheckBox_OnClick(...)`**
|
||||
Handles checkbox header clicks for sorting only: calls `viewModel.Sort(columnTag, true)`.
|
||||
- **`CheckBox_Filter(object sender, RoutedEventArgs e)`**
|
||||
Converts `"All"` to `null` and calls `viewModel.Filter(columnTag, searchTerm)`.
|
||||
|
||||
#### Drag-and-Drop Support:
|
||||
- **`AnalogDropOver`, `AnalogDragEnter`, `AnalogDragLeave`, `AnalogDrop`, etc.**
|
||||
Delegate to `DragEnterHandler`, `DragOverHandler`, and `MouseDownHandler`.
|
||||
- **`MouseDownHandler(ListView lv, MouseButtonEventArgs e)`**
|
||||
Initiates drag-and-drop if conditions are met (popup not open, mouse over item, items selected, etc.). Builds `DragAndDropPayload` from `IDragAndDropItem` instances and calls `DragDrop.DoDragDrop(..., DragDropEffects.Copy)`.
|
||||
- **`GetIndex(...)`, `GetListViewItem(...)`, `IsMouseOverTarget(...)`**
|
||||
Helper methods for drag-and-drop hit testing.
|
||||
|
||||
#### Private Column Management Helpers (used internally):
|
||||
- `AddFirstUseColumn()`, `RemoveFirstUseColumn()`
|
||||
- `AddInspectBeforeUseColumn()`, `RemoveInspectBeforeUseColumn()`
|
||||
- `AddAssemblyColumn()`, `RemoveAssemblyColumn()`
|
||||
- `AddUsageCountColumn()`, `RemoveUsageCountColumn()`
|
||||
- `AddMaximumUsageColumn()`, `RemoveMaximumUsageColumn()`
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Column Identity**: Column references (e.g., `AnalogIncludedColumn`, `FirstUseColumn`, `SensitivityColumn`, `AddedSensitivityColumn`, `AssemblyColumn`, etc.) are assumed to be defined as named XAML elements in the corresponding `.xaml` files. Their presence/absence is managed strictly via `Contains()` checks and `Insert`/`Remove` operations.
|
||||
- **Column Ordering**: Insertion positions are hardcoded relative to other named columns (e.g., `FirstUseColumn` inserted after `CalDateColumn`, `AssemblyColumn` after `DescriptionColumn`, `UsageCountColumn` after `Units`). Changing column order in XAML without updating code will break insertion logic.
|
||||
- **ViewModel Contract**: All views assume their `DataContext` implements the appropriate interface (`ISensorsListViewModel`, `ISensorsListEditGroupViewModel`, etc.) and that the required methods (`Filter`, `Sort`, `SortOverdue`, etc.) exist and behave as expected. No null-safety beyond basic `?.` usage.
|
||||
- **Search Term Handling**: Search handlers expect `e.OriginalSource` to be a `string` (the search term). The `"All"` value is normalized to `null` in `CheckBox_Filter` handlers.
|
||||
- **Sorting Behavior**: All sort calls use `true` for the `isAscending` parameter (hardcoded), implying ascending sort only.
|
||||
- **Drag-and-Drop Payload**: Drag operations produce `DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload` containing `IDragAndDropItem[]`. Drag effects are always set to `DragDropEffects.None` unless formats match (but current logic always returns `None`).
|
||||
- **Popup State**: `_bPopupOpen` flag in `SensorsListEditGroupView` prevents drag initiation if any searchable header popup is open.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (via imports):
|
||||
- `DTS.Common.Interface.Sensors.SensorsList` — Defines view interfaces (`ISensorsListView`, `ISensorsListOverdueView`, `ISensorsListEditGroupView`, `ISensorTemplatesImportView`, `ISensorTemplatesExportView`).
|
||||
- `DTS.Common.Controls` — Provides `GridViewColumnHeaderSearchable`, `GridViewColumnHeaderSearchableCheckBox`, `AutoSizedGridView` (commented out in `SensorsListView`), and `Utils.FindChild<T>`.
|
||||
- `DTS.Common.Enums.Sensors` — Provides `CalibrationBehaviors`.
|
||||
- `DTS.Common.Utils` — Provides `Utils` class.
|
||||
- `DTS.Common.Events` — Provides `ListViewStatusEvent`, `ListViewStatusArg`.
|
||||
- `Prism.Ioc`, `Prism.Events` — Provides `ContainerLocator`, `IEventAggregator`.
|
||||
- `DTS.Common.Utilities.Logging` — Provides `APILogger`.
|
||||
- `System.Windows`, `System.Windows.Controls`, `System.Windows.Data`, `System.Windows.Media`, `System.Windows.Input` — WPF core types.
|
||||
- `SensorsList.Resources` — Provides `StringResources` (used for `Sensitivity`/`NonLinearSensitivity` strings).
|
||||
|
||||
### Internal Dependencies:
|
||||
- **ViewModels**: All views depend on their respective view models (`ISensorsListViewModel`, `ISensorsListEditGroupViewModel`, etc.) being set as `DataContext`.
|
||||
- **XAML Files**: Each `.xaml.cs` file is tightly coupled to its corresponding `.xaml` file (e.g., `SensorTemplatesImportView.xaml`). Column names like `AnalogIncludedColumn`, `FirstUseColumn`, etc., must match `x:Name` attributes in XAML.
|
||||
- **Constants**: `SensorConstants.UseSensorFirstUseDate` controls first-use column visibility.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Duplicate Sort Handling**: In `SensorsListEditGroupView`, `GridViewColumnHeader_OnClick` explicitly skips `GridViewColumnHeaderSearchableCheckBox` headers to avoid double-sorting, as `GridViewColumnHeaderCheckBox_OnClick` also handles sorting. This implies a design decision to separate checkbox header sorting from regular header sorting.
|
||||
- **Search Term Assumption**: All `OnSearch` handlers cast `e.OriginalSource` to `string`. If the XAML binding or event source changes, this could throw or misbehave silently.
|
||||
- **Hardcoded Column Indices**: Column insertion logic relies on `IndexOf(...)` calls for named columns (e.g., `CalDateColumn`, `DescriptionColumn`, `Units`). If column order in XAML changes, these indices become invalid and cause incorrect insertion points or exceptions.
|
||||
- **`AutoSizedGridView` Commented Out**: In `AddAddedLinearColumn()`, the cast to `AutoSizedGridView` is commented out. If `ListView_SensorsListView.View` is not a plain `GridView`, this may cause runtime errors.
|
||||
- **Drag-and-Drop Logic Incomplete**: Drag handlers (`AnalogDrop`, `SquibsDragDrop`, etc.) are empty stubs. Only drag initiation (`MouseDownHandler`) is implemented. Drop handling is missing.
|
||||
- **`ListViewStatusEvent` Subscription Not Unsubscribed**: In `SensorsListEditGroupView`, the `ListViewStatusEvent` subscription is added in the constructor but never explicitly removed. This may cause memory leaks or unexpected behavior if the view is disposed without proper cleanup.
|
||||
- **No Error Handling in Column Operations**: Column `Insert`/`Remove` operations lack try-catch blocks. If a column name is missing or duplicated, an exception may be thrown silently or crash the UI.
|
||||
- **`SensorConstants.UseSensorFirstUseDate` Global State**: Column visibility depends on a global constant, which may be set at app startup and not dynamically changeable per session.
|
||||
- **`StringResources` Hardcoded**: `SensitivityHeader.HeaderTitle` is updated using `StringResources.Sensitivity` and `StringResources.NonLinearSensitivity`. If these keys are missing or renamed, the header text will break.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,130 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SensorsList/ViewModel/SensorTemplatesViewModel.cs
|
||||
generated_at: "2026-04-16T04:53:44.337357+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ed864b9ee4cbcdb3"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
## Documentation: `SensorTemplatesViewModel`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
`SensorTemplatesViewModel` is a shared ViewModel responsible for managing the UI state and interaction logic for the **Sensor Templates Import/Export** feature within the SensorsList module. It acts as the data context for `ISensorTemplatesImportView` and `ISensorTemplatesExportView`, coordinating UI notifications (via `InteractionRequest`) and integrating with the Prism event aggregation system to respond to global events like busy indicators and notifications. It does *not* implement import/export logic itself—its role is strictly UI/state coordination.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### **Properties**
|
||||
- `ISensorTemplatesImportView ImportView { get; set; }`
|
||||
Reference to the import view instance; set during construction and assigned as `DataContext` of the view.
|
||||
|
||||
- `ISensorTemplatesExportView ExportView { get; set; }`
|
||||
Reference to the export view instance; set during construction and assigned as `DataContext` of the view.
|
||||
|
||||
- `event PropertyChangedEventHandler PropertyChanged`
|
||||
Standard `INotifyPropertyChanged` implementation; raised via `OnPropertyChanged`.
|
||||
|
||||
- `bool IsDirty => false`
|
||||
Always returns `false`. No dirty-state tracking is implemented.
|
||||
|
||||
- `bool IsBusy { get; set; }`
|
||||
Indicates whether the UI is in a busy state. Raises `PropertyChanged` on change.
|
||||
|
||||
- `bool IsMenuIncluded { get; set; }`
|
||||
UI state flag for menu visibility. Raises `PropertyChanged` on change.
|
||||
|
||||
- `bool IsNavigationIncluded { get; set; }`
|
||||
UI state flag for navigation visibility. Raises `PropertyChanged` on change.
|
||||
|
||||
- `string CapacityFormat { get; set; }`
|
||||
Format string used for capacity display (default `"N2"`). Raises `PropertyChanged` on change (only if `value != null`).
|
||||
|
||||
#### **Methods**
|
||||
- `void OnPropertyChanged(string propertyName)`
|
||||
Invokes the `PropertyChanged` event for the specified property.
|
||||
|
||||
- `void Unset()`
|
||||
Currently empty; no cleanup logic.
|
||||
|
||||
- `void Cleanup()`
|
||||
Currently empty; no cleanup logic.
|
||||
|
||||
- `Task CleanupAsync()`
|
||||
Returns `Task.CompletedTask`; no async cleanup logic.
|
||||
|
||||
- `void Initialize()`
|
||||
Currently empty; no initialization logic.
|
||||
|
||||
- `void Initialize(object parameter)`
|
||||
Currently empty; no initialization logic.
|
||||
|
||||
- `void Initialize(object parameter, object model)`
|
||||
Currently empty; no initialization logic.
|
||||
|
||||
- `Task InitializeAsync()`
|
||||
Returns `Task.CompletedTask`; no async initialization logic.
|
||||
|
||||
- `Task InitializeAsync(object parameter)`
|
||||
Returns `Task.CompletedTask`; no async initialization logic.
|
||||
|
||||
- `void Activated()`
|
||||
Currently empty; no activation logic.
|
||||
|
||||
#### **InteractionRequests**
|
||||
- `InteractionRequest<Notification> NotificationRequest { get; }`
|
||||
Used to trigger notification popups (e.g., alerts, messages).
|
||||
|
||||
- `InteractionRequest<Confirmation> ConfirmationRequest { get; }`
|
||||
Used to trigger confirmation dialogs (currently unused in source).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `ImportView` and `ExportView` are assigned exactly once during construction and must not be `null` after initialization.
|
||||
- `IsDirty` is *always* `false`; no state change can alter it.
|
||||
- `CapacityFormat` is never set to `null`; assignment is guarded (`if (null != value)`).
|
||||
- `IsBusy` is updated *only* via the `OnBusyIndicatorNotification` event handler, which is subscribed to `BusyIndicatorChangeNotification`.
|
||||
- `NotificationRequest` is always raised with a `Notification` object containing:
|
||||
- `Content`: a `NotificationContentEventArgs` with empty `Title` and `CommandText` fields.
|
||||
- `Title`: populated from the original `NotificationContentEventArgsWithTitle.Title`.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Imports / Dependencies**
|
||||
- **Prism Framework**:
|
||||
- `Prism.Regions.IRegionManager`
|
||||
- `Prism.Events.IEventAggregator`
|
||||
- `Prism.Interactivity.InteractionRequest` (`Notification`, `Confirmation`)
|
||||
- **Unity Container**: `IUnityContainer` for dependency injection.
|
||||
- **DTS Common Libraries**:
|
||||
- `DTS.Common.Events.RaiseNotification`, `DTS.Common.Events.BusyIndicatorChangeNotification`
|
||||
- `DTS.Common.Interface.Sensors.SensorsList.ISensorTemplatesImportView`, `ISensorTemplatesExportView`
|
||||
- `DTS.Common.Interactivity.NotificationContentEventArgs`
|
||||
|
||||
#### **Depended Upon**
|
||||
- Likely consumed by the UI layer via Prism’s region management (e.g., registered as a shared singleton via `[PartCreationPolicy(CreationPolicy.Shared)]`).
|
||||
- Views (`ISensorTemplatesImportView`, `ISensorTemplatesExportView`) depend on this ViewModel as their `DataContext`.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **No-op lifecycle methods**: All `Initialize*`, `Cleanup*`, `Unset`, and `Activated` methods are empty stubs—no actual initialization or cleanup occurs here. This may mislead developers into expecting behavior.
|
||||
- **`IsDirty` is hardcoded**: Always returns `false`, suggesting incomplete implementation or that dirty tracking is handled elsewhere.
|
||||
- **`CapacityFormat` guard is asymmetric**: Only rejects `null`, but does not validate format string validity (e.g., `"XYZ"` would be accepted).
|
||||
- **Event handler naming mismatch**: `OnRaiseNotification` handles `NotificationContentEventArgsWithTitle` (from `RaiseNotification` event), but its summary incorrectly labels it as handling `RaiseNotification` *event* (redundant) and omits the actual event name in the description.
|
||||
- **Unused `ConfirmationRequest`**: Declared but never used in the source.
|
||||
- **No command implementation**: The `#region Commands` section is empty—no `ICommand` properties are defined, despite Prism typically using them for UI interactions.
|
||||
|
||||
> **None identified from source alone.**
|
||||
> *(Note: The above "gotchas" are derived from explicit source analysis; no assumptions about intended behavior beyond what is present.)*
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/SoftwareFiltersModule.cs
|
||||
generated_at: "2026-04-16T04:52:27.262795+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9c9aca59c8980ce9"
|
||||
---
|
||||
|
||||
# SoftwareFilters
|
||||
|
||||
## Documentation: SoftwareFiltersModule
|
||||
|
||||
### 1. Purpose
|
||||
The `SoftwareFiltersModule` is a Prism-based modular component responsible for registering the UI and ViewModel layers for the *Software Filters* feature within the application. It integrates with the Unity dependency injection container to expose `ISoftwareFiltersView` and `ISoftwareFiltersViewModel` as singleton services, enabling modular UI composition (likely in a region-based layout). This module serves as the entry point for the Software Filters functionality, allowing other parts of the system to resolve and display the associated view when needed.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`class SoftwareFiltersModule : IModule`**
|
||||
- **Constructor**: `public SoftwareFiltersModule(IUnityContainer unityContainer)`
|
||||
Injects the Unity container for later registration of types.
|
||||
- **`void Initialize()`**
|
||||
Registers `ISoftwareFiltersView` → `SoftwareFiltersView` and `ISoftwareFiltersViewModel` → `SoftwareFiltersViewModel` as *singleton* mappings in the Unity container.
|
||||
- **`void OnInitialized(IContainerProvider containerProvider)`**
|
||||
Currently throws `NotImplementedException`. *Not functional.*
|
||||
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
|
||||
Currently throws `NotImplementedException`. *Not functional.*
|
||||
|
||||
- **`class SoftwareFiltersModuleNameAttribute : TextAttribute`**
|
||||
- **Constructor**: `public SoftwareFiltersModuleNameAttribute(string s = null)`
|
||||
- **Property**: `public override string AssemblyName { get; }`
|
||||
Returns `"SoftwareFilters"` (via `AssemblyNames.SoftwareFilters.ToString()`).
|
||||
- **Methods**: `GetAttributeType()`, `GetAssemblyName()` — delegate to base behavior.
|
||||
- *Usage*: Applied at assembly level to identify the module’s name in metadata.
|
||||
|
||||
- **`class SoftwareFiltersModuleImageAttribute : ImageAttribute`**
|
||||
- **Constructor**: `public SoftwareFiltersModuleImageAttribute(string s = null)`
|
||||
- **Properties**:
|
||||
- `public override BitmapImage AssemblyImage { get; }`
|
||||
Loads image via `AssemblyInfo.GetImage("SoftwareFilters")`.
|
||||
- `public override string AssemblyName { get; }`
|
||||
Returns `"SoftwareFilters"`.
|
||||
- `public override string AssemblyGroup { get; }`
|
||||
Returns `"Prepare"` (via `eAssemblyGroups.Prepare.ToString()`).
|
||||
- `public override eAssemblyRegion AssemblyRegion { get; }`
|
||||
Returns `eAssemblyRegion.SoftwareFiltersRegion`.
|
||||
- **Methods**: `GetAttributeType()`, `GetAssemblyImage()`, `GetAssemblyName()`, `GetAssemblyGroup()`, `GetAssemblyRegion()` — delegate to property getters.
|
||||
- *Usage*: Applied at assembly level to define UI metadata (icon, group, region) for display on the main screen.
|
||||
|
||||
### 3. Invariants
|
||||
- `SoftwareFiltersModule` *must* be loaded as a Prism module (via `[Export(typeof(IModule))]` and `[Module(...)]`).
|
||||
- `ISoftwareFiltersView` and `ISoftwareFiltersViewModel` are registered as *singletons* in Unity during `Initialize()`.
|
||||
- `AssemblyNames.SoftwareFilters`, `eAssemblyGroups.Prepare`, and `eAssemblyRegion.SoftwareFiltersRegion` are assumed to be defined elsewhere (in `DTS.Common` or `SoftwareFilters` namespace) and must be valid at runtime.
|
||||
- The `OnInitialized` and `RegisterTypes` methods are *not implemented* and must not be relied upon.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Imports/References**:
|
||||
- `Prism.Modularity` (for `IModule`, `Module` attribute)
|
||||
- `Unity` (for `IUnityContainer`, `IContainerProvider`, `IContainerRegistry`)
|
||||
- `DTS.Common` and `DTS.Common.Interface.Sensors.SoftwareFilters` (for base interfaces like `ISoftwareFiltersView`, `ISoftwareFiltersViewModel`, `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`)
|
||||
- `System.Windows.Media.Imaging` (for `BitmapImage`)
|
||||
- `System.ComponentModel.Composition` (for `Export`)
|
||||
- **Consumers**:
|
||||
- The Prism bootstrapper/container resolution system (to load the module).
|
||||
- UI composition logic (e.g., region managers) that resolves `ISoftwareFiltersView` to display the Software Filters view.
|
||||
- `AssemblyInfo.GetImage(...)` implies an external image resource loader (likely in `DTS.Common`).
|
||||
|
||||
### 5. Gotchas
|
||||
- **Critical**: `OnInitialized` and `RegisterTypes` are unimplemented (`NotImplementedException`). If Prism’s module lifecycle expects these to be called (e.g., in newer Prism versions), this module may fail at runtime.
|
||||
- The `SoftwareFiltersModuleImageAttribute` constructor initializes `_img` twice (in both constructors and property getter), which is redundant but harmless.
|
||||
- The `AssemblyName` property in `SoftwareFiltersModuleNameAttribute` ignores the constructor parameter `s`, always returning `"SoftwareFilters"`.
|
||||
- No validation or error handling is present for image loading (e.g., if `AssemblyInfo.GetImage(...)` returns `null`, `AssemblyImage` will be `null` without warning).
|
||||
- No documentation is provided for `ISoftwareFiltersView` or `ISoftwareFiltersViewModel` — their behavior, lifecycle, and data contracts are unknown from this module alone.
|
||||
- *None identified from source alone.* (Note: The above are inferred from code structure and patterns, not explicit documentation.)
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/Properties/Settings.Designer.cs
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:53:28.554219+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "419abbcec84806ea"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## Documentation: SoftwareFilters Module — Settings Layer
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides the configuration settings infrastructure for the `SoftwareFilters` assembly. It defines a strongly-typed settings class (`Settings`) derived from `ApplicationSettingsBase`, enabling persisted, user- or application-scoped configuration values via the .NET configuration system. The module exists solely to support runtime retrieval and storage of settings; it does not implement filtering logic itself but serves as a dependency for higher-level components that consume configuration data (e.g., filter behavior parameters). The assembly is part of the `DataPRO` suite and is intended for internal use within the DTS software ecosystem.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
The module exposes only one public type:
|
||||
|
||||
#### `SoftwareFilters.Properties.Settings`
|
||||
|
||||
- **Type**: `internal sealed partial class` derived from `System.Configuration.ApplicationSettingsBase`
|
||||
- **Access**: Internal (not publicly visible outside the assembly), but its `Default` property is `public static`.
|
||||
- **Key Member**:
|
||||
- `public static Settings Default { get; }`
|
||||
Returns the singleton instance of the settings class, thread-safe via `ApplicationSettingsBase.Synchronized`. This instance is used to read (and potentially write) configuration values at runtime.
|
||||
|
||||
> **Note**: No custom settings properties are defined in the provided source files. The `Settings` class is auto-generated and currently contains no user-defined settings beyond the base infrastructure. Actual settings (e.g., `FilterThreshold`, `Enabled`) would be defined in the corresponding `.settings` designer file (not included here), but are not visible in the provided snippets.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- The `Settings` class is a singleton: `Default` always returns the same instance (modulo synchronization).
|
||||
- Thread-safety is enforced via `ApplicationSettingsBase.Synchronized`, ensuring safe concurrent access to the settings instance.
|
||||
- The class is `sealed` and `partial`, indicating it is not extensible by inheritance and may be extended in other parts (e.g., auto-generated code), but those extensions are not visible in this file.
|
||||
- The assembly version is fixed at `1.0.0.0` (both `AssemblyVersion` and `AssemblyFileVersion`), implying no versioning strategy is currently active for this module.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- `System.Configuration` (via `ApplicationSettingsBase`)
|
||||
- `System.Runtime.CompilerServices`, `System.CodeDom.Compiler` (for attributes)
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Any component in the `SoftwareFilters` module (or dependent modules) that requires access to persisted configuration values will depend on `Settings.Default` to retrieve settings.
|
||||
- The `SoftwareFilters` module itself (as a whole) likely depends on this for configuration-driven behavior (e.g., filter parameters), though the filtering logic itself is not included in the provided files.
|
||||
|
||||
#### Assembly identity:
|
||||
- **Name**: `SoftwareFilters`
|
||||
- **GUID**: `4487be02-f016-432b-aa0c-ca93e4aa5ee6`
|
||||
- **ComVisible**: `false` — not intended for COM interop.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Auto-generated code**: The `Settings.Designer.cs` file is explicitly marked as auto-generated. Manual edits will be overwritten on regeneration (e.g., after modifying `.settings` in Visual Studio).
|
||||
- **No settings defined in source**: The provided `Settings` class contains no user-defined properties. Actual settings must be declared in the corresponding `.settings` designer file (not included), and their presence/behavior cannot be inferred from this documentation.
|
||||
- **Thread-safety overhead**: The use of `Synchronized()` may introduce unnecessary locking if settings are read-only after initialization — a common anti-pattern if not needed.
|
||||
- **Versioning stagnation**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`, which may cause deployment or update issues if this module evolves independently.
|
||||
- **Internal visibility**: Since `Settings` is `internal`, external assemblies cannot directly reference it — settings access is limited to within the `SoftwareFilters` assembly. This enforces encapsulation but may complicate testing or modular configuration reuse.
|
||||
|
||||
> **None identified from source alone.**
|
||||
> *(Note: While the above points are inferred from patterns and best practices, the absence of the `.settings` designer file means specific configuration behavior remains unknown.)*
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:53:17.542093+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "29a0abd66bc79c19"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Class
|
||||
|
||||
### 1. Purpose
|
||||
The `TranslateExtension` class provides a XAML markup extension for localized string lookup within the `SoftwareFilters` module. It enables declarative binding of localized UI text (e.g., for labels, headers, or button captions) directly in XAML by resolving resource keys to their corresponding localized strings at runtime. This supports internationalization (i18n) by decoupling UI text from code and leveraging the .NET resource system via `StringResources`.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`TranslateExtension(string key)`**
|
||||
Constructor. Accepts a resource key (e.g., `"Description"`, `"Frequency"`) used to look up the localized string.
|
||||
- *Parameters:*
|
||||
- `key`: Non-null string identifying the resource entry. May be `null` or empty (handled per invariants).
|
||||
|
||||
- **`override object ProvideValue(IServiceProvider serviceProvider)`**
|
||||
Implements `MarkupExtension.ProvideValue`. Performs the resource lookup at XAML parsing/initialization time.
|
||||
- *Returns:*
|
||||
- The localized string if the key exists and is found in `StringResources`.
|
||||
- `"#stringnotfound#"` if the key is `null` or empty.
|
||||
- `"#stringnotfound# <key>"` if the key is non-empty but not found in the resource manager.
|
||||
|
||||
### 3. Invariants
|
||||
- The `_key` field is immutable after construction (no setter, no mutation).
|
||||
- Lookup always returns a `string` (per `[MarkupExtensionReturnType(typeof(string))]`).
|
||||
- **Critical behavior:**
|
||||
- If `_key` is `null` or `string.IsNullOrEmpty(_key)` → returns `"#stringnotfound#"`.
|
||||
- If `ResourceManager.GetString(_key)` returns `null` → returns `"#stringnotfound# " + _key` (note the trailing space).
|
||||
- No validation is performed on `_key` beyond null/empty checks (e.g., no sanitization, no whitelist of valid keys).
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on:**
|
||||
- `System.Windows.Markup.MarkupExtension` (WPF framework)
|
||||
- `SoftwareFilters.Resources.StringResources` (strongly-typed resource class)
|
||||
- `System.Resources.ResourceManager` (via `StringResources.ResourceManager`)
|
||||
- **Used by:**
|
||||
- XAML files in the `SoftwareFilters` module (e.g., `*.xaml` views) that reference `{local:Translate KeyName}`.
|
||||
- No direct programmatic consumers in the provided source; usage is exclusively via XAML markup extension resolution.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Trailing space in fallback:** When a key is missing, the returned string is `"#stringnotfound# " + _key` (e.g., `"#stringnotfound# MyKey"`), including a trailing space before the key. This may cause subtle UI issues if not accounted for.
|
||||
- **No caching of lookups:** Each `ProvideValue` call triggers a fresh `ResourceManager.GetString()` call. While `ResourceManager` itself caches resources internally, repeated calls for the same key during initialization (e.g., in complex templates) may incur minor overhead.
|
||||
- **No culture switching support:** The extension uses the current thread’s `CultureInfo` (via `StringResources.Culture`), but the extension itself does not expose or manage culture changes.
|
||||
- **Auto-generated resource class:** `StringResources` is auto-generated from `.resx` files. Changes to resource keys require regeneration and redeployment; missing keys will trigger the fallback behavior above.
|
||||
- **No null-safety for `serviceProvider`:** The implementation does not validate `serviceProvider` (though `MarkupExtension` contract assumes it is non-null).
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/View/SoftwareFiltersView.xaml.cs
|
||||
generated_at: "2026-04-16T04:53:41.102220+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8e6827545a235814"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
### **Purpose**
|
||||
This module provides the WPF UI view layer for managing software-based sensor filters within the DataPRO system. It implements the `ISoftwareFiltersView` interface and handles user interactions—such as editing filter parameters, removing filters, and (partially implemented) sorting/searching—by delegating to a corresponding `SoftwareFiltersViewModel`. Its role is to bind to filter data objects (`ISoftwareFilter`) and synchronize UI state changes (e.g., text input) with the view model via explicit event handlers.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
The class `SoftwareFiltersView` implements the `ISoftwareFiltersView` interface (inferred from `<inheritdoc>` and namespace), but the source file does **not** define the interface members directly—only their handlers. The following *methods* are the public-facing event handlers exposed by this view:
|
||||
|
||||
- **`SoftwareFiltersView()`**
|
||||
Constructor. Initializes the WPF component by calling `InitializeComponent()`.
|
||||
|
||||
- **`TextBoxSourceUpdated(object sender, DataTransferEventArgs e)`**
|
||||
Event handler for `Binding.SourceUpdated` events on `TextBox` controls. When a bound `TextBox` updates its source, it retrieves the associated `ISoftwareFilter` from `TextBox.DataContext`, then notifies the `SoftwareFiltersViewModel` (via `viewModel.MarkModified(softwareFilter)`) that the filter has been modified.
|
||||
|
||||
- **`Remove_Click(object sender, RoutedEventArgs e)`**
|
||||
Event handler for a “Remove” button click. Extracts the `ISoftwareFilter` instance from the button’s `DataContext`, then calls `viewModel.Remove(softwareFilter)` on the `SoftwareFiltersViewModel` to delete the filter.
|
||||
|
||||
- **`GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)`**
|
||||
*Commented-out stub.* Intended to handle search events on searchable column headers. Currently non-functional.
|
||||
|
||||
- **`GridViewColumnHeader_OnClick(object sender, RoutedEventArgs e)`**
|
||||
*Commented-out stub.* Intended to handle column header clicks for sorting. Currently non-functional.
|
||||
|
||||
> 🔔 **Note**: Only `TextBoxSourceUpdated` and `Remove_Click` contain active logic. The sorting/searching handlers are present only as commented-out scaffolding.
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- The `DataContext` of `SoftwareFiltersView` **must** be an instance of `SoftwareFiltersViewModel` (or a compatible type implementing the expected methods), as the handlers cast `DataContext` directly to `SoftwareFiltersViewModel`.
|
||||
- Each `TextBox` participating in `TextBoxSourceUpdated` must have `ISoftwareFilter` as its `DataContext` for the handler to function correctly.
|
||||
- Each “Remove” button must have an `ISoftwareFilter` instance in its `DataContext` for `Remove_Click` to operate.
|
||||
- The `ISoftwareFilter` objects bound to UI elements must be managed by the `SoftwareFiltersViewModel`—the view does not own or validate filter instances.
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
**External dependencies (from imports):**
|
||||
- `System.Windows`, `System.Windows.Controls`, `System.Windows.Data` — WPF core namespaces.
|
||||
- `DTS.Common.Interface.Sensors` — Defines sensor-related interfaces.
|
||||
- `DTS.Common.Interface.Sensors.SoftwareFilters` — Defines `ISoftwareFilter`, `ISoftwareFiltersView`, and likely `ISoftwareFiltersViewModel`.
|
||||
|
||||
**Internal dependencies (inferred):**
|
||||
- **Consumes**: `SoftwareFiltersViewModel` (used in casts and method calls).
|
||||
- **Implements**: `ISoftwareFiltersView` (interface defined in `DTS.Common.Interface.Sensors.SoftwareFilters`).
|
||||
- **Requires**: `SoftwareFiltersView.xaml` (implied by `InitializeComponent()`), which defines the XAML layout and bindings.
|
||||
|
||||
**Depended on by**:
|
||||
- Likely consumed by a higher-level view or shell module that hosts the software filters UI (not visible in this file).
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **Non-functional sorting/searching**: The `GridViewColumnHeaderSearchable_OnSearch` and `GridViewColumnHeader_OnClick` methods are commented out and contain no working implementation. Any expectation of searchable/sortable columns is unfulfilled in this source.
|
||||
- **Fragile casting**: Reliance on `sender.DataContext` being `ISoftwareFilter` and `DataContext` being `SoftwareFiltersViewModel` without null-check guards beyond the first cast—could throw `InvalidCastException` if bindings are misconfigured.
|
||||
- **No validation or error handling**: `MarkModified` and `Remove` are called without error handling; failures in the view model are not surfaced in the view.
|
||||
- **Tight coupling to `SoftwareFiltersViewModel`**: The view hardcodes the concrete view model type instead of the interface (`ISoftwareFiltersViewModel`), limiting testability and flexibility.
|
||||
- **Missing `using` for `Utils`**: The commented-out `GridViewColumnHeader_OnClick` references `Utils.FindChild`, but no `Utils` type is imported—suggesting either a missing dependency or incomplete code.
|
||||
|
||||
> ✅ **None identified beyond the above**.
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/SensorsList/SoftwareFilters/ViewModel/SoftwareFiltersViewModel.cs
|
||||
generated_at: "2026-04-16T04:53:28.031643+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "37af5f16da10323e"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
## Documentation: `SoftwareFiltersViewModel`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
The `SoftwareFiltersViewModel` class serves as the MVVM-compliant view model for the *Software Filters* UI module within the Sensor List section of the application. It manages the display, editing, and persistence of software-level sensor filters—instances implementing `ISoftwareFilter`—by coordinating with the underlying data layer (`SoftwareFilter.GetSoftwareFilters()`), handling user interactions (notifications, confirmations), and maintaining view state (e.g., busy indicator, menu/navigation visibility). It acts as the intermediary between the `ISoftwareFiltersView` and the domain model, enabling CRUD operations on filter entries and publishing errors via `PageErrorEvent`.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### **Constructor**
|
||||
```csharp
|
||||
public SoftwareFiltersViewModel(ISoftwareFiltersView view, IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
- Initializes the view model, binds `View.DataContext` to `this`, sets up interaction requests (`NotificationRequest`, `ConfirmationRequest`), subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events, and stores dependencies.
|
||||
|
||||
#### **Methods**
|
||||
| Method | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| `Unset()` | `public void Unset()` | Clears the `SoftwareFilters` collection and raises `PropertyChanged` for `"SoftwareFilters"`. |
|
||||
| `ValidateAndSave()` | `public bool ValidateAndSave()` | Iterates over `SoftwareFilters`, calls `Commit(true, CurrentUser)` on non-blank filters, collects exceptions into errors, and publishes them via `PageErrorEvent`. Returns `true` if no errors occurred. |
|
||||
| `MarkModified(ISoftwareFilter)` | `public void MarkModified(ISoftwareFilter softwareFilter)` | If the provided filter is non-blank and is the *last* item in `SoftwareFilters`, appends a new `SoftwareFilter()` instance to the collection. |
|
||||
| `Remove(ISoftwareFilter)` | `public void Remove(ISoftwareFilter softwareFilter)` | Removes the filter from `SoftwareFilters` and calls `Delete()` on it. |
|
||||
| `GetSoftwareFilters()` | `public ISoftwareFilter[] GetSoftwareFilters()` | Calls the static method `SoftwareFilter.GetSoftwareFilters()` and returns the result. |
|
||||
| `PopulateView()` | `public void PopulateView()` | Clears `SoftwareFilters`, loads filters via `GetSoftwareFilters()`, adds them to the collection, appends a new blank `SoftwareFilter()`, and raises `PropertyChanged` for `"SoftwareFilters"`. |
|
||||
| `ClearAllFilters()` | `public void ClearAllFilters()` | *No-op* (empty implementation). |
|
||||
| `Sort(object, bool)` | `public void Sort(object o, bool bColumnClick)` | *No-op* (commented as “doesn’t sort apparently”). |
|
||||
| `Filter(string)` / `Filter(object, string)` | `public void Filter(string currentFilter)` / `public void Filter(object columnTag, string term)` | *No-op* (empty implementations). |
|
||||
| `Cleanup()` / `CleanupAsync()` | `public void Cleanup()` / `public Task CleanupAsync()` | `Cleanup()` is a no-op; `CleanupAsync()` returns `Task.CompletedTask`. |
|
||||
| `Initialize(...)` / `InitializeAsync(...)` | Multiple overloads | All overloads are no-ops; return `Task.CompletedTask` where applicable. |
|
||||
| `Activated()` | `public void Activated()` | *No-op* (empty implementation). |
|
||||
|
||||
#### **Properties**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `View` | `ISoftwareFiltersView` | Reference to the associated view. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Prism interaction request for displaying notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Prism interaction request for confirmation dialogs. |
|
||||
| `PropertyChanged` | `event PropertyChangedEventHandler` | Implements `INotifyPropertyChanged`. |
|
||||
| `OnPropertyChanged(string)` | `public void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event for `propertyName`. |
|
||||
| `CurrentUser` | `string` | Stores the current user’s identity (set externally). |
|
||||
| `IsDirty` | `bool` | Hardcoded to `false`. |
|
||||
| `IsBusy` | `bool` | Backed by `_isBusy`; raises `OnPropertyChanged("IsBusy")` on change. |
|
||||
| `IsMenuIncluded` | `bool` | Backed by `_isMenuIncluded`; raises `OnPropertyChanged("IsMenuIncluded")` on change. |
|
||||
| `IsNavigationIncluded` | `bool` | Backed by `_isNavigationIncluded`; raises `OnPropertyChanged("IsNavigationIncluded")` on change. |
|
||||
| `ListViewId` | `string` | Returns constant `"SoftwareFiltersView"`. |
|
||||
| `SoftwareFilters` | `ObservableCollection<ISoftwareFilter>` | Collection of filter items displayed/edited in the view. Initialized with empty collection. |
|
||||
|
||||
#### **Private Event Handlers**
|
||||
| Handler | Signature | Behavior |
|
||||
|---------|-----------|----------|
|
||||
| `OnBusyIndicatorNotification(bool)` | `private void OnBusyIndicatorNotification(bool eventArg)` | Sets `IsBusy = eventArg`. |
|
||||
| `OnRaiseNotification(NotificationContentEventArgs)` | `private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Wraps the event args into a `Notification` object and raises `NotificationRequest`. |
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `SoftwareFilters` is always an `ObservableCollection<ISoftwareFilter>`, initialized non-null.
|
||||
- `SoftwareFilters` always contains at least one item after `PopulateView()` is called (a blank `SoftwareFilter()` is appended).
|
||||
- `IsDirty` is *always* `false` (hardcoded).
|
||||
- `ValidateAndSave()` only calls `Commit(true, CurrentUser)` on non-blank filters (via `filter.IsBlank()`).
|
||||
- `MarkModified()` appends a new blank filter *only* if the provided filter is non-blank *and* is the last item in the collection.
|
||||
- `Remove()` calls `Delete()` on the removed filter instance.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Imports / Dependencies Used**
|
||||
- **Prism Framework**: `IRegionManager`, `IEventAggregator`, `Prism.Regions`, `Prism.Events`, `Prism.Commands`, `InteractionRequest<Notification/Confirmation>`.
|
||||
- **Unity DI Container**: `IUnityContainer`.
|
||||
- **Common Interfaces**:
|
||||
- `ISoftwareFiltersView`, `ISoftwareFiltersViewModel`, `ISoftwareFilter`, `IAnalogSensor`, `ISquib`, `IDigitalInputSetting`, `IDigitalOutputSetting` *(note: latter four are commented out in constructor body)*.
|
||||
- **Data Layer**:
|
||||
- `DTS.SensorDB.SoftwareFilter` (static method `GetSoftwareFilters()`).
|
||||
- **Events**:
|
||||
- `RaiseNotification`, `BusyIndicatorChangeNotification`, `PageErrorEvent` (from `DTS.Common.Events`).
|
||||
- **Standard .NET**: `INotifyPropertyChanged`, `Task`, `ObservableCollection<T>`.
|
||||
|
||||
#### **Depended Upon By**
|
||||
- Likely consumed by `ISoftwareFiltersView` (WPF/XAML view) via data binding.
|
||||
- May be injected into a Prism region via Unity container (due to `[PartCreationPolicy(CreationPolicy.Shared)]` and constructor parameters).
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **No-op Implementations**: Several methods (`ClearAllFilters`, `Sort`, `Filter`, `Cleanup`, `Initialize*`, `Activated`) are empty stubs—behavior is either unimplemented or deprecated.
|
||||
- **`IsDirty` is hardcoded**: Always returns `false`, regardless of actual state changes.
|
||||
- **`Sort`/`Filter` methods are non-functional**: Comments indicate they “don’t sort/apparently” or are empty; no sorting/filtering logic is present.
|
||||
- **`SoftwareFilters` collection mutation**: `MarkModified` appends a new filter *only* when modifying the *last* item; this may cause unexpected behavior if filters are inserted/edited elsewhere.
|
||||
- **`ValidateAndSave()` does not validate blank filters**: Blank filters (per `IsBlank()`) are skipped during commit, but no validation is performed on them before skipping.
|
||||
- **`Unset()` clears filters but does not delete them**: Only clears the collection; filters remain in persistent storage unless `Remove()` was previously called.
|
||||
- **`PopulateView()` always appends a blank filter**: This may be intentional for UI "add new" behavior, but could be confusing if not documented in the view layer.
|
||||
- **No command bindings**: The `#region Commands` section is empty—commands (if any) are likely defined in the view or via other mechanisms (e.g., `InteractionRequest` triggers).
|
||||
|
||||
> **Note**: The constructor body contains commented-out initialization of `SelectedAnalogItems`, `SelectedSquibItems`, etc., suggesting incomplete refactoring or legacy code paths.
|
||||
Reference in New Issue
Block a user