init
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/Model/TestSetupComparer.cs
|
||||
generated_at: "2026-04-16T04:51:41.503080+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c8e267fd60a22a5e"
|
||||
---
|
||||
|
||||
# Model
|
||||
|
||||
### **Purpose**
|
||||
The `TestSetupComparer` class provides a customizable comparison implementation for sorting collections of `ITestSetup` objects. It enables ordering test setups by various fields (e.g., name, description, timestamps) in either ascending or descending order, supporting UI-driven sorting scenarios (e.g., table column sorting). It serves as a concrete implementation of `IComparer<ITestSetup>` to integrate with .NET’s sorting infrastructure (e.g., `List<T>.Sort`, LINQ’s `OrderBy`).
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
|
||||
#### `public class TestSetupComparer : IComparer<ITestSetup>`
|
||||
A comparer that compares two `ITestSetup` instances based on configurable criteria.
|
||||
|
||||
- **`public TestSetupFields SortField { get; set; } = TestSetupFields.Name;`**
|
||||
Gets or sets the field by which to sort. Defaults to `TestSetupFields.Name`. Must be a valid member of the `TestSetupFields` enum (defined in `DTS.Common.Enums.TestSetups.TestSetupList`).
|
||||
|
||||
- **`public bool SortAscending { get; set; } = true;`**
|
||||
Gets or sets the sort direction. `true` for ascending order (default), `false` for descending.
|
||||
|
||||
- **`public int Compare(ITestSetup left, ITestSetup right)`**
|
||||
Compares two `ITestSetup` instances (`left` and `right`) based on the current `SortField` and `SortAscending` settings. Returns:
|
||||
- `< 0` if `left` < `right` (ascending) or `left` > `right` (descending),
|
||||
- `0` if equal,
|
||||
- `> 0` if `left` > `right` (ascending) or `left` < `right` (descending).
|
||||
Handles `null` inputs: `null` is treated as *less than* any non-null value. If `SortField` is unrecognized, falls back to comparing hash codes.
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- `SortField` must be one of the values defined in `TestSetupFields` (from `DTS.Common.Enums.TestSetups.TestSetupList`). Invalid values are *not* validated at runtime; they fall through to the hash-code comparison fallback.
|
||||
- `null` is consistently ordered before non-null instances, regardless of `SortField` or `SortAscending`.
|
||||
- If `left == right` (reference equality), `Compare` returns `0` *before* evaluating field values.
|
||||
- The comparison for string fields (`Name`, `Description`, `LastModifiedBy`) is **case-insensitive** (`StringComparison.OrdinalIgnoreCase`).
|
||||
- The comparison for numeric/enum fields (`RecordingMode`, `PreTriggerSeconds`, `PostTriggerSeconds`, `LastModified`, `IsComplete`) uses their respective `IComparable.CompareTo` implementations.
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
- **Imports/References**:
|
||||
- `DTS.Common.Enums.TestSetups.TestSetupList` → Provides `TestSetupFields` enum.
|
||||
- `DTS.Common.Interface.TestSetups.TestSetupsList` → Defines `ITestSetup` interface (contract for test setup objects).
|
||||
- **Depended upon by**:
|
||||
- Any code requiring sorted `ITestSetup` collections (e.g., UI view models, data grids, or list processors in the `TestSetupsList` module or related layers).
|
||||
- *Inferred*: Likely used in conjunction with `ITestSetup` implementations (e.g., concrete test setup classes implementing the interface).
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **No validation of `SortField`**: If `SortField` is set to an undefined or future enum value, the `switch` falls back to `a.GetHashCode().CompareTo(b.GetHashCode())`, which yields *unstable* and *semantically meaningless* ordering.
|
||||
- **Hash-code fallback is unsafe for sorting**: Using `GetHashCode()` as a tiebreaker (or primary fallback) does not guarantee transitivity or consistency across runs (hash codes may vary per process), potentially violating `IComparer` contract requirements.
|
||||
- **No null-safety for `ITestSetup` properties**: The comparer assumes `a.Name`, `a.Description`, etc., are non-null. If any property (e.g., `LastModifiedBy`) is `null`, `string.Compare` or `CompareTo` may throw `NullReferenceException`.
|
||||
- **Reference equality check before null checks**: The initial `if (left == right)` check is redundant with later `if (a == b)` after swapping, but harmless.
|
||||
- **No handling of `DateTime` precision**: `LastModified` comparison relies on `DateTime.CompareTo`, which includes ticks—sub-millisecond differences may matter in edge cases.
|
||||
- **Case-insensitive string comparison may be inconsistent across cultures**: `StringComparison.OrdinalIgnoreCase` is safe for English, but not fully culture-agnostic (e.g., Turkish 'i' issues are avoided, but other edge cases may exist).
|
||||
|
||||
*None identified beyond the above.*
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/Properties/Settings.Designer.cs
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:51:28.954974+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ad8e54ff33790aba"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## Documentation Page: `TestSetupsList.Properties.Settings`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides strongly-typed, application-scoped settings access for the `TestSetupsList` module via the .NET `ApplicationSettingsBase` infrastructure. It serves as the runtime accessor for user- or application-level configuration values (though no settings properties are currently defined in the generated code), enabling consistent retrieval of persisted configuration data using the standard .NET settings pattern. As a generated file, it is not intended for manual modification and exists solely to support the module’s integration with Visual Studio’s settings designer.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
- **`Settings.Default`**
|
||||
```csharp
|
||||
internal static Settings Default { get; }
|
||||
```
|
||||
A static property returning the singleton instance of the `Settings` class, synchronized for thread safety via `ApplicationSettingsBase.Synchronized`. This is the *only* public entry point to the settings system in this module. No additional properties or methods are defined in the source—any settings (e.g., `string TestSetupPath`, `bool AutoLoadLast`) would be auto-generated as instance properties on the `Settings` class but are not present in the provided snippet.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- The `Settings` class is **sealed** and **internal**, preventing inheritance or external instantiation.
|
||||
- Thread-safety is enforced via `ApplicationSettingsBase.Synchronized`, ensuring the singleton instance is safe for concurrent access.
|
||||
- The `Default` property always returns the same instance (singleton behavior), initialized once on first access.
|
||||
- The class inherits from `ApplicationSettingsBase`, which enforces that settings values conform to their declared types and default values as defined in the `.config` file or designer.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Dependencies *of* this module**:
|
||||
- `System.Configuration` (for `ApplicationSettingsBase`)
|
||||
- `System.Runtime.CompilerServices` (for `CompilerGeneratedAttribute`)
|
||||
- `System.CodeDom.Compiler` (for `GeneratedCodeAttribute`)
|
||||
- `System.Runtime.InteropServices` (for `ComVisibleAttribute`, referenced in `AssemblyInfo.cs`)
|
||||
|
||||
- **Dependencies *on* this module**:
|
||||
- Other modules or classes within `TestSetupsList` (or the broader `DataPRO` solution) may consume `TestSetupsList.Properties.Settings.Default` to read persisted settings. However, no direct usages are visible in the provided source files.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **No settings are currently defined**: The `Settings` class contains only boilerplate code (singleton accessor and attributes). No user-defined settings properties (e.g., `public string SomeSetting { get; set; }`) appear in the source—these would be auto-generated by Visual Studio’s settings designer and are absent here. Thus, `Settings.Default` currently exposes *no configurable values*.
|
||||
- **Auto-generated file**: Manual edits will be overwritten on regeneration (e.g., after modifying settings in the IDE). Configuration changes must be made via the Visual Studio settings designer (`.settings` file) or directly in the `App.config`/`TestSetupsList.exe.config`.
|
||||
- **Thread-safety overhead**: While `Synchronized()` ensures thread safety, it may introduce performance overhead in high-frequency access scenarios—though this is unlikely for settings, which are typically read infrequently.
|
||||
- **Assembly versioning**: The assembly version is hardcoded to `1.0.0.0` (with `AssemblyFileVersion` identical), which may complicate version tracking or side-by-side deployments if not managed externally.
|
||||
|
||||
> **Note**: Since no settings properties are defined in the provided source, behavior beyond the singleton accessor cannot be documented. Any runtime settings usage must be inferred from other modules or files not included here.
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:51:19.579629+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9ca0cf52c1c54e32"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Markup Extension
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
The `TranslateExtension` class is a WPF `MarkupExtension` used to enable localized string binding in XAML. It resolves resource keys (e.g., `"Name"`, `"Description"`) to their corresponding localized string values at runtime by querying the strongly-typed `StringResources` class. This allows UI elements (e.g., `TextBlock.Text`, `HeaderedContentControl.Header`) to display culture-specific text without hardcoding strings, supporting internationalization of the TestSetupsList module.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TranslateExtension` class
|
||||
|
||||
- **Constructor**
|
||||
```csharp
|
||||
public TranslateExtension(string key)
|
||||
```
|
||||
- **Parameters**:
|
||||
- `key`: The resource key (e.g., `"Name"`, `"LastModifiedBy"`) used to look up a localized string in `StringResources`.
|
||||
- **Behavior**: Stores the key for later resolution during `ProvideValue`.
|
||||
|
||||
- **`ProvideValue` method**
|
||||
```csharp
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
```
|
||||
- **Returns**:
|
||||
- If `_key` is `null` or empty → `"#stringnotfound#"`
|
||||
- If `StringResources.ResourceManager.GetString(_key)` returns a non-null value → that string
|
||||
- Otherwise → `"#stringnotfound# " + _key` (e.g., `"#stringnotfound# UnknownKey"`)
|
||||
- **Behavior**: Performs the actual resource lookup. Does *not* use the `serviceProvider` parameter (per source).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- `_key` is immutable after construction (no setter, no modification in `ProvideValue`).
|
||||
- Resource keys are expected to match *exact* keys in the `.resx` file (e.g., `"Name"`, `"PreTriggerSeconds"`), case-sensitive.
|
||||
- The fallback string `"#stringnotfound#"` is hardcoded and used for both missing keys and empty keys.
|
||||
- `StringResources.ResourceManager.GetString(_key)` is called with the *current UI culture* (via `CultureInfo` stored in `StringResources.Culture`), not thread culture directly.
|
||||
- `StringResources` is auto-generated; manual edits to `StringResources.Designer.cs` will be overwritten.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* `TranslateExtension`:
|
||||
- `System.Windows.Markup.MarkupExtension` (WPF base class)
|
||||
- `TestSetupsList.Resources.StringResources` (strongly-typed resource class)
|
||||
- Relies on `System.Resources.ResourceManager` and `System.Globalization.CultureInfo`
|
||||
- Requires the `StringResources.resx` file to be compiled into the `TestSetupsList` assembly (implied by `"TestSetupsList.Resources.StringResources"` in `ResourceManager` constructor).
|
||||
|
||||
#### Dependencies *on* `TranslateExtension`:
|
||||
- XAML files in the `TestSetupsList` module that use `{local:Translate KeyName}` syntax (where `local` maps to `TestSetupsList` namespace).
|
||||
- No direct runtime dependencies beyond WPF and the resource assembly.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **No null-safety for missing keys**: A key like `"NonExistent"` yields `"#stringnotfound# NonExistent"` — not `null`, not an exception. This may cause visible artifacts in UI if not handled.
|
||||
- **Empty key handling**: Passing `""` or `null` to the constructor returns `"#stringnotfound#"` silently — no warning or exception.
|
||||
- **No caching of resolved values**: `ProvideValue` calls `ResourceManager.GetString(_key)` on *every invocation* (e.g., if used in a `DataTemplate` with many items). This is likely acceptable for typical UI strings but could be optimized.
|
||||
- **No support for format strings or parameters**: Unlike `String.Format`, this extension does *not* support placeholders (e.g., `"Hello {0}"`). Resource keys must resolve to fully formed strings.
|
||||
- **Designer.cs auto-generation warning**: Manual changes to `StringResources.Designer.cs` will be lost on rebuild. Resource keys must be added/modified via the `.resx` designer or file.
|
||||
- **No `serviceProvider` usage**: The `ProvideValue` method ignores the WPF-provided `IServiceProvider`, meaning it cannot resolve culture dynamically per context (e.g., per element). Relies solely on `StringResources.Culture`.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/View/TestSetupsListView.xaml.cs
|
||||
generated_at: "2026-04-16T04:51:42.688811+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "41a808b797fa9251"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
### **1. Purpose**
|
||||
This module implements the WPF view layer (`TestSetupsListView`) for the test setups list UI component. It serves as the concrete implementation of the `ITestSetupsListView` interface, handling user interactions such as column header clicks (for sorting), searchable column header events (for filtering), and double-clicks on list items (to trigger a view-model action). It bridges the UI (defined in `TestSetupsListView.xaml`) with the view model (`ITestSetupsListViewModel`) by translating WPF events into structured view-model method calls.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
The class itself is public and implements `ITestSetupsListView`, but the source file does **not expose any public methods or properties beyond the constructor**. All behavior is implemented via private event handlers wired in XAML (not shown). The public interface is therefore:
|
||||
|
||||
- **`TestSetupsListView()`**
|
||||
Public constructor. Calls `InitializeComponent()` to load the XAML-defined UI. This is the standard WPF entry point for initializing the view.
|
||||
|
||||
> **Note**: All interaction logic resides in *private* event handlers (`ListViewHeader_Click`, `GridViewColumnHeaderSearchable_OnSearch`, `GridViewColumnHeader_OnClick`, `MouseDoubleClick`). These are invoked via XAML event bindings and are not directly callable from outside the class.
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- The `DataContext` of the `ListView` (and thus the view) **must** be an instance implementing `ITestSetupsListViewModel`. This is assumed by all event handlers (e.g., `vm?.Sort(...)`, `vm.Filter(...)`, `vm.MouseDoubleClick(...)`).
|
||||
- Column headers used for sorting **must** have their `Tag` property set to a valid sort key (typically a string or enum representing the column/field).
|
||||
- For searchable column headers, the `Tag` property must be set to identify the column for filtering, and the `GridViewColumnHeaderSearchable` type must be used (from `DTS.Common.Controls`).
|
||||
- The `MouseDoubleClick` handler assumes the `ListView` contains items in a one-to-one mapping with indices; it uses `ItemContainerGenerator.ContainerFromIndex` to resolve the visual item under the mouse.
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
**Imports/References (from source):**
|
||||
- `System.Windows.*` (WPF core: `Window`, `Controls`, `Data`, `Media`, `Input`)
|
||||
- `DTS.Common.Controls` (provides `GridViewColumnHeaderSearchable`, `Utils.FindChild<T>`)
|
||||
- `DTS.Common.Interface.TestSetups.TestSetupsList` (provides `ITestSetupsListView`, `ITestSetupsListViewModel`)
|
||||
- `DTS.Common.Utils` (provides utility methods like `Utils.FindChild<T>`)
|
||||
|
||||
**Depended on by:**
|
||||
- XAML (`TestSetupsListView.xaml`) — binds events to the private handlers.
|
||||
- The view model (`ITestSetupsListViewModel` implementation) — must be assigned to `DataContext` for the view to function.
|
||||
- Likely consumed by a parent view or navigation system that instantiates `TestSetupsListView` as a control.
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **Ambiguous event routing**: Two handlers (`ListViewHeader_Click` and `GridViewColumnHeader_OnClick`) appear to handle column header clicks. `ListViewHeader_Click` assumes `e.OriginalSource` is a `GridViewColumnHeader`, while `GridViewColumnHeader_OnClick` uses `sender as GridViewColumnHeaderSearchable` and falls back to `Utils.FindChild<GridViewColumnHeaderSearchable>`. This suggests legacy or overlapping event wiring—caution is needed to avoid duplicate sorting/filtering logic.
|
||||
- **Null-safety reliance**: The `MouseDoubleClick` handler uses `vm?.Sort(...)` and similar null-conditional operators, implying `DataContext` may sometimes be `null`. However, the view is likely unusable without a valid view model.
|
||||
- **Index resolution fragility**: `GetCurrentIndex` iterates over `lv.Items.Count`, calling `ContainerFromIndex`—which may return `null` for virtualized or not-yet-realized items. This could cause double-clicks near the edge of the viewport to be missed.
|
||||
- **Search handler signature mismatch**: `GridViewColumnHeaderSearchable_OnSearch` casts `e.OriginalSource` to `string` for `searchTerm`, but `RoutedEventArgs.OriginalSource` is typically a UI element (e.g., a `TextBox` or `ComboBox`). This suggests the XAML passes the search term via `CommandParameter` or similar, but the cast is unsafe and likely incorrect unless the event is routed from a custom control.
|
||||
- **No public API for programmatic control**: The view offers no methods to programmatically trigger sorting/filtering—only via user interaction. This limits testability and integration flexibility.
|
||||
- **Missing documentation**: The class inherits XML doc from `ITestSetupsListView`, but the interface itself is not included—behavioral details of `Sort`, `Filter`, and `MouseDoubleClick` are inferred from usage, not defined here.
|
||||
@@ -0,0 +1,119 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/TestSetups/TestSetupsList/ViewModel/TestSetupsListViewModel.cs
|
||||
generated_at: "2026-04-16T04:51:29.820169+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ed9dca56ffa30a15"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
## Documentation: `TestSetupsListViewModel`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module implements the view model for the Test Setups list UI, responsible for managing the display, filtering, sorting, and selection of test setups in the application. It acts as the intermediary between the `ITestSetupsListView` (view) and the underlying data (`ITestSetup[]`), coordinating with Prism’s event aggregation system to decouple UI interactions (e.g., selection, double-click) from other system components. It supports multi-field filtering, column-based sorting, busy state indication, and notification display via interaction requests.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### **Properties**
|
||||
|
||||
| Property | Type | Description |
|
||||
|---------|------|-------------|
|
||||
| `View` | `ITestSetupsListView` | Reference to the associated view; view’s `DataContext` is set to `this` in constructor. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Prism interaction request used to raise notification popups. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Prism interaction request used to raise confirmation dialogs. |
|
||||
| `SelectedTestSetupIndex` | `int` | Zero-based index of the currently selected item in the list view; defaults to `-1`. |
|
||||
| `SelectedTestSetupItems` | `BulkObservableCollection<ITestSetup>` | Collection of currently selected test setups; raises `TestSetupsListTestSetupSelectedEvent` on change. |
|
||||
| `TestSetups` | `ITestSetup[]` | Current filtered/sorted list of test setups displayed in the view. |
|
||||
| `IsDirty` | `bool` | Read-only; always `false` (no dirty state tracked). |
|
||||
| `IsBusy` | `bool` | Indicates whether a long-running operation is in progress; updated via `BusyIndicatorChangeNotification` event. |
|
||||
| `IsMenuIncluded` | `bool` | Controls visibility of menu UI elements. |
|
||||
| `IsNavigationIncluded` | `bool` | Controls visibility of navigation UI elements. |
|
||||
| `ListViewId` | `string` | Returns `"TestSetupsListView"`; used for event scoping. |
|
||||
|
||||
#### **Methods**
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ClearAllFilters` | `public void ClearAllFilters()` | Clears all per-field search terms stored in `_currentSearchTermByField`. |
|
||||
| `Unset` | `public void Unset()` | Resets internal state: clears `_allTestSetup` and `TestSetups`, clears filters, and publishes `ListViewStatusEvent` with status `Unloaded`. |
|
||||
| `Sort` | `public void Sort(object o, bool bColumnClick)` | Sorts `TestSetups` by field (`o` as `string` tag parsed to `TestSetupFields`). If `bColumnClick` is `true`, toggles sort direction on repeated clicks of same column; otherwise, applies current sort without toggling. |
|
||||
| `Filter` | `public void Filter(object objectTag, string term)` | Sets per-field search term for `TestSetupFields` parsed from `objectTag`, then invokes `Filter(string)`. |
|
||||
| `Filter` | `public void Filter(string term)` | Applies global search `term` (case-insensitive substring match) across *all* fields using `ITestSetup.Filter(string)` and `TestSetupFilter`. Updates `TestSetups`. |
|
||||
| `SetTestSetups` | `public void SetTestSetups(ITestSetup[] allTestSetupsForUser)` | Sets `_allTestSetup`, then applies current filter and sort to populate `TestSetups`. |
|
||||
| `Cleanup` | `public void Cleanup()` | No-op. |
|
||||
| `CleanupAsync` | `public Task CleanupAsync()` | Returns `Task.CompletedTask`. |
|
||||
| `Initialize` / `InitializeAsync` | Multiple overloads | All no-ops; no initialization logic implemented. |
|
||||
| `Activated` | `public void Activated()` | No-op. |
|
||||
| `MouseDoubleClick` | `public void MouseDoubleClick(int index)` | If valid index and exactly one item selected, publishes `TestSetupsListEditTestSetupEvent` with the selected test setup’s `Name`. |
|
||||
|
||||
#### **Private Helpers**
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `TestSetupFilter` | `private bool TestSetupFilter(ITestSetup t)` | Implements per-field filtering logic: for each field with a non-empty search term, checks case-insensitive substring match (or boolean conversion for `IsComplete`). Returns `false` if any field fails. |
|
||||
| `FireSelectionChanged` | `private void FireSelectionChanged()` | Publishes `TestSetupsListTestSetupSelectedEvent` with array of selected test setup names. |
|
||||
| `SelectedTestSetupItemsOnCollectionChanged` | `private void SelectedTestSetupItemsOnCollectionChanged(...)` | Handles `CollectionChanged`; skips re-firing selection event if `GetUpdating()` returns `true` and collection is non-null/non-empty (workaround for bug #18382). |
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `TestSetups` is always a subset of `_allTestSetup`, filtered and sorted per current criteria.
|
||||
- `_currentSearchTermByField` keys are exclusively `TestSetupFields` enum values.
|
||||
- `SelectedTestSetupItems.CollectionChanged` event is subscribed exactly once per assignment (unsubscribes old, subscribes new).
|
||||
- `IsBusy` is updated only via subscription to `BusyIndicatorChangeNotification` event.
|
||||
- `ListViewId` is constant: `"TestSetupsListView"`.
|
||||
- `SelectedTestSetupItems` defaults to a `BulkObservableCollection<ITestSetup>`; never `null` after construction.
|
||||
- `TestSetups` is initialized as `new ITestSetup[0]` in `Unset()` and constructor; never `null`.
|
||||
- `Sort()` ensures `TestSetups` is never left unsorted; if already sorted, flips direction and re-sorts.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Imports/Usings (External)**
|
||||
- `Prism.Events` (`IEventAggregator`, `EventBase`)
|
||||
- `Prism.Regions` (`IRegionManager`)
|
||||
- `Unity` (`IUnityContainer`)
|
||||
- `DTS.Common.Events.*` (e.g., `RaiseNotification`, `BusyIndicatorChangeNotification`, `ListViewStatusEvent`, `TestSetupsListEditTestSetupEvent`, `TestSetupsListTestSetupSelectedEvent`)
|
||||
- `DTS.Common.Interface.TestSetups.TestSetupsList` (`ITestSetupsListView`, `ITestSetup`)
|
||||
- `DTS.Common.Enums.TestSetups.TestSetupList` (`TestSetupFields`, `ListViewStatusArg`)
|
||||
- `DTS.Common.Interactivity` (`InteractionRequest<Notification>`, `InteractionRequest<Confirmation>`)
|
||||
- `DTS.Common.Classes` (`BulkObservableCollection<T>`)
|
||||
|
||||
#### **Internal Dependencies**
|
||||
- `TestSetupsList.Model` namespace (likely contains `TestSetupComparer`, `ITestSetup` implementations).
|
||||
- `ITestSetup` interface must define:
|
||||
- `Name`, `Description`, `RecordingMode`, `PreTriggerSeconds`, `PostTriggerSeconds`, `LastModified`, `LastModifiedBy`, `IsComplete` properties.
|
||||
- `Filter(string term)` method for global search.
|
||||
|
||||
#### **Consumers (Inferred)**
|
||||
- `TestSetupsListEditTestSetupEvent` subscribers (e.g., edit view model/controller).
|
||||
- `TestSetupsListTestSetupSelectedEvent` subscribers (e.g., detail view or command handlers).
|
||||
- `ListViewStatusEvent` subscribers (e.g., layout or state manager).
|
||||
- `RaiseNotification` and `BusyIndicatorChangeNotification` publishers.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **`IsDirty` is unused**: Always `false`; no dirty state tracking is implemented despite property existence.
|
||||
- **`Initialize*` and `Cleanup*` methods are no-ops**: Despite implementing Prism’s `INavigationAware`/`IInitializeAsync` patterns, no initialization or cleanup logic is present.
|
||||
- **`Sort()` behavior on identical sequences**: If the list is already sorted, it flips `_sortAscending` and re-sorts — this may cause unexpected sort direction toggling on first sort if data was pre-sorted.
|
||||
- **`TestSetupFilter` uses `Convert.ToBoolean(term)` for `IsComplete`**: Fails if `term` is not `"True"`/`"False"` (case-insensitive); throws `FormatException` for invalid strings.
|
||||
- **`MouseDoubleClick` requires exactly one selected item**: Double-click only triggers edit if `SelectedTestSetupItems.Count == 1`; multi-select disables this behavior.
|
||||
- **Bug workaround in `SelectedTestSetupItemsOnCollectionChanged`**: Skips `FireSelectionChanged()` when `GetUpdating()` returns `true` *and* collection is non-empty — relies on external `DTS.Common.Enums.SelectedItemsStatus.GetUpdating()` logic (not visible here).
|
||||
- **No validation on `Filter` term**: Non-numeric `term` for `IsComplete` will cause `Convert.ToBoolean(term)` to throw.
|
||||
- **`ClearAllFilters()` does not re-apply current global filter**: Only clears per-field terms; global `_currentSearchFilter` remains unchanged, but `TestSetups` is not recomputed until `Filter(string)` is called again.
|
||||
- **Thread safety**: `OnBusyIndicatorNotification` uses `ThreadOption.PublisherThread`, but other event handlers (`OnRaiseNotification`) use default (likely background thread); UI updates (`IsBusy`, `NotificationRequest.Raise`) must be marshaled to UI thread — Prism handles this via `InteractionRequest`, but `IsBusy` property setter calls `OnPropertyChanged` directly (assumes `INotifyPropertyChanged` subscribers are thread-aware or dispatcher is used elsewhere).
|
||||
|
||||
---
|
||||
|
||||
*Documentation generated from `TestSetupsListViewModel.cs` alone. Behavior not derivable from source is marked as unknown.*
|
||||
Reference in New Issue
Block a user