init
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Model/TestSummaryModel.cs
|
||||
generated_at: "2026-04-16T11:17:27.563683+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "eacbbab8741bd493"
|
||||
---
|
||||
|
||||
# Documentation: TestSummaryModel.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`TestSummaryModel` is a model class within the `DTS.Viewer.TestSummaryList` module that orchestrates loading and merging test summary data from `.dts` files. It implements `IBaseModel` and serves as the data acquisition layer for the test summary list view, handling asynchronous file system operations, event publication for UI state management (busy indicators, app status), and intelligent merging of newly loaded tests with existing collections while preserving user selection state.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Properties
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `ITestSummaryListViewModel Parent { get; set; }` | Reference to the parent view model. Must be set before calling `GetTestSummary`. Used to access and modify `TestSummaryList`, `SelectedTestSummaryList`, and `IsBusy` state. |
|
||||
| `IEventAggregator _eventAggregator { get; set; }` | Prism event aggregator for publishing events. Despite the underscore prefix (typically indicating private), this is a public property. Must be set before calling `GetTestSummary`. |
|
||||
| `bool IsSaved { get; }` | Read-only property. Appears to be an unimplemented auto-property (always returns default `false`). |
|
||||
|
||||
### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void GetTestSummary(string path, string file, bool Include = false, bool selectAll = false)` | Loads test definitions from the specified path/file. Creates the directory if it doesn't exist. Merges results into `Parent.TestSummaryList`, replacing duplicates (matched by `Id`, `SetupName`, and `DataType`) while preserving selection state. Publishes `BusyIndicatorChangeNotification`, `AppStatusExEvent`, and `TestLoadedCountNotification` events. Executes work asynchronously via `Dispatcher.CurrentDispatcher.InvokeAsync` with `DispatcherPriority.Background`. |
|
||||
| `void OnPropertyChanged(string propertyName)` | Raises the `PropertyChanged` event for the specified property name. |
|
||||
|
||||
### Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `event PropertyChangedEventHandler PropertyChanged` | Standard `INotifyPropertyChanged` implementation. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Parent must be assigned** before calling `GetTestSummary`. The method accesses `Parent.IsBusy`, `Parent.TestSummaryList`, and `Parent.SelectedTestSummaryList` without null checks.
|
||||
- **_eventAggregator must be assigned** before calling `GetTestSummary`. Events are published without null checks.
|
||||
- **Duplicate detection key**: Tests are considered duplicates if they match on all three properties: `Id`, `SetupName`, and `DataType`.
|
||||
- **Selection preservation**: When replacing a duplicate test, the `IsSelected` state is preserved from the replaced test.
|
||||
- **Collection event handling**: When `Parent.TestSummaryList` is empty, the new list is assigned directly and `CollectionChanged` is wired to `Parent.TestSummaryList_CollectionChanged`. When non-empty, items are added/inserted individually.
|
||||
- **Async execution**: `GetTestSummary` returns immediately; actual work is dispatched asynchronously. Callers cannot await completion.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` — `IBaseModel` interface
|
||||
- `DTS.Common.Classes.Viewer.TestMetadata` — `TestMetadataList` class
|
||||
- `DTS.Common.Events` — `BusyIndicatorChangeNotification`, `AppStatusExEvent`, `AppStatusExArg`, `AppStatusArg`, `TestLoadedCountNotification`, `TestLoadedCountNotificationArg`
|
||||
- `DTS.Common.Interface` — (specific interfaces unclear from source)
|
||||
- `DTS.Viewer.TestSummaryList.ViewModel` — `ITestSummaryListViewModel`, `TestSummaryViewListModel`
|
||||
- `Prism.Events` — `IEventAggregator`
|
||||
- `System.Windows.Threading` — `Dispatcher`, `DispatcherPriority`
|
||||
- `System.Windows` — `MessageBox`
|
||||
- `System.IO` — `Directory`
|
||||
- `System.Linq` — LINQ extension methods
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from this source file alone. The `Parent` property suggests consumption by `ITestSummaryListViewModel` implementations.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Misleading XML documentation**: The `<summary>` for `GetTestSummary` states "Returns list of Test Definition" but the method returns `void`.
|
||||
|
||||
2. **Naming convention violation**: `_eventAggregator` uses an underscore prefix (conventionally indicating private fields) but is a public property.
|
||||
|
||||
3. **Fire-and-forget async pattern**: `GetTestSummary` dispatches work via `InvokeAsync` with no mechanism for callers to know when loading completes. The `IsBusy` flag and event publications are the only completion signals.
|
||||
|
||||
4. **Silent exception swallowing**: Lines 99-108 contain a try/catch with an empty catch block (`catch (Exception) { }`). The comment indicates this was added for a regression build to prevent crashes from a new feature (case 16158).
|
||||
|
||||
5. **Unimplemented property**: `IsSaved` is a get-only auto-property with no backing field assignment, meaning it always returns `false`.
|
||||
|
||||
6. **Hardcoded string literal**: The string `"ALL"` is used for `DataType` comparison in `DetermineTestsSelected` without a constant or enum.
|
||||
|
||||
7. **UI coupling in model**: The model directly shows a `MessageBox` on errors (line 113), violating separation of concerns.
|
||||
|
||||
8. **Case reference comments**: Multiple comments reference an internal manuscript system (e.g., `http://manuscript.dts.local/f/cases/28164/`) which are inaccessible outside the organization.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:16:50.245640+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3de23a946bdde4b4"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.TestSummaryList Assembly Configuration
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This file provides assembly-level metadata and configuration for the `DTS.Viewer.TestSummaryList` module (compiled as `DTS.Viewer.Test`). It is a standard .NET Framework `AssemblyInfo.cs` file that defines version information, COM visibility settings, and identification attributes. This module appears to be part of a larger DTS Viewer application, specifically handling test summary list functionality.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
This file contains no public functions, classes, or methods. It consists entirely of assembly-level attributes:
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| `AssemblyTitle` | `"DTS.Viewer.Test"` |
|
||||
| `AssemblyDescription` | `""` (empty) |
|
||||
| `AssemblyConfiguration` | `""` (empty) |
|
||||
| `AssemblyCompany` | `""` (empty) |
|
||||
| `AssemblyProduct` | `"DTS.Viewer.Test"` |
|
||||
| `AssemblyCopyright` | `"Copyright © 2017"` |
|
||||
| `AssemblyTrademark` | `""` (empty) |
|
||||
| `AssemblyCulture` | `""` (empty) |
|
||||
| `ComVisible` | `false` |
|
||||
| `Guid` | `"b2b2b862-1b93-476a-8246-91e1310c7ec7"` |
|
||||
| `AssemblyVersion` | `"1.0.0.0"` |
|
||||
| `AssemblyFileVersion` | `"1.0.0.0"` |
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **COM Visibility**: All types in this assembly are not visible to COM components (`ComVisible(false)`). If COM interop is required, individual types must explicitly set `[ComVisible(true)]`.
|
||||
- **Version Consistency**: Both `AssemblyVersion` and `AssemblyFileVersion` are set to `"1.0.0.0"` and must be updated together when versioning changes.
|
||||
- **Assembly Identity**: The GUID `b2b2b862-1b93-476a-8246-91e1310c7ec7` uniquely identifies this assembly's type library if exposed to COM.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `System.Reflection` - For assembly metadata attributes
|
||||
- `System.Runtime.CompilerServices` - For compiler-related attributes
|
||||
- `System.Runtime.InteropServices` - For COM interop attributes
|
||||
|
||||
**What depends on this module:**
|
||||
- Unclear from source alone. This is a configuration file; the actual module implementation would be in other source files within the `DTS.Viewer.TestSummaryList` project.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Naming Inconsistency**: The directory/module name is `DTS.Viewer.TestSummaryList`, but the `AssemblyTitle` and `AssemblyProduct` are set to `"DTS.Viewer.Test"`. This discrepancy may cause confusion when referencing the assembly or interpreting logs/diagnostics.
|
||||
- **Empty Metadata Fields**: `AssemblyDescription`, `AssemblyCompany`, and `AssemblyConfiguration` are all empty strings, which may indicate incomplete documentation or placeholder values.
|
||||
- **Legacy Project Format**: The presence of an explicit `AssemblyInfo.cs` file suggests this is using the older .NET Framework project style (pre-SDK-style projects), which may affect build tooling and migration paths.
|
||||
- **Hardcoded Version**: The version `1.0.0.0` appears to be a placeholder that has not been updated since the copyright year of 2017.
|
||||
@@ -0,0 +1,129 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/StringResources.ja.Designer.cs
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/TranslateExtension.cs
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T11:16:26.757827+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ef8f2f0524698a0d"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.TestSummaryList.Resources
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides localization/internationalization infrastructure for the TestSummaryList component of the DTS Viewer application. It enables XAML-based string resource lookups through a WPF markup extension (`TranslateExtension`) and exposes strongly-typed access to localized UI strings via the auto-generated `StringResources` class. The module supports the display of test summary information with sortable columns and metadata labels.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TranslateExtension (DTS.Viewer.TestSummaryList namespace)
|
||||
|
||||
A WPF markup extension for resolving localized strings in XAML bindings.
|
||||
|
||||
```csharp
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public TranslateExtension(string key)
|
||||
```
|
||||
- Creates an instance with the specified resource key to look up.
|
||||
|
||||
**Method:**
|
||||
```csharp
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
```
|
||||
- Returns the localized string for the stored key via `StringResources.ResourceManager.GetString(_key)`.
|
||||
- Returns `#stringnotfound#` if `_key` is null or empty.
|
||||
- Returns `#stringnotfound# {key}` if the key is valid but no resource is found.
|
||||
|
||||
---
|
||||
|
||||
### StringResources (DTS.Viewer.TestSummaryList.Resources namespace)
|
||||
|
||||
An internal, auto-generated strongly-typed resource class.
|
||||
|
||||
```csharp
|
||||
internal class StringResources
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ResourceManager` | `global::System.Resources.ResourceManager` (static) | Cached ResourceManager instance for the `DTS.Viewer.TestSummaryList.Resources.StringResources` resource bundle. |
|
||||
| `Culture` | `global::System.Globalization.CultureInfo` (static) | Gets or sets the current thread's UI culture for resource lookups. |
|
||||
|
||||
**Localized String Properties (all `internal static string`):**
|
||||
|
||||
| Property | Default Value (from comments) |
|
||||
|----------|-------------------------------|
|
||||
| `Browse` | "Browse..." |
|
||||
| `ChannelCount` | "Channels: " |
|
||||
| `Description` | "Description: " |
|
||||
| `FileDate` | "File Date: " |
|
||||
| `FileDateAscending` | "File Date" |
|
||||
| `FileDateDescending` | "File Date (Descending)" |
|
||||
| `IdAscending` | "Test ID" |
|
||||
| `IdDescending` | "Test ID (Descending)" |
|
||||
| `Refresh` | "Refresh" |
|
||||
| `SetupNameAscending` | "Test Setup" |
|
||||
| `SetupNameDescending` | "Test Setup (Descending)" |
|
||||
| `Sort` | "Sort: " |
|
||||
| `TestID` | "Test ID: " |
|
||||
| `TestSetup` | "Test Setup: " |
|
||||
| `TimeStamp` | "TimeStamp: " |
|
||||
| `TimeStampAscending` | "TimeStamp" |
|
||||
| `TimeStampDescending` | "TimeStamp (Descending)" |
|
||||
| `Type` | "Type: " |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Auto-generation constraint**: `StringResources` is auto-generated by `System.Resources.Tools.StronglyTypedResourceBuilder` (version 17.0.0.0). Manual edits will be lost upon regeneration.
|
||||
|
||||
2. **Non-null return guarantee**: `TranslateExtension.ProvideValue()` always returns a non-null string. It never returns null—missing keys produce error indicators.
|
||||
|
||||
3. **Error format for missing keys**: When a resource key is not found, the return value follows the pattern `#stringnotfound# {key}` where `{key}` is the requested key name.
|
||||
|
||||
4. **Empty key handling**: A null or empty `_key` returns exactly `#stringnotfound#` without a trailing key name.
|
||||
|
||||
5. **Resource manager identity**: The `ResourceManager` property always returns an instance tied to the resource name `"DTS.Viewer.TestSummaryList.Resources.StringResources"` within the current assembly.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` (core types)
|
||||
- `System.Windows.Markup` (`MarkupExtension`, `MarkupExtensionReturnTypeAttribute`)
|
||||
- `System.Resources` (`ResourceManager`)
|
||||
- `System.Globalization` (`CultureInfo`)
|
||||
- `System.CodeDom.Compiler` (generated code attributes)
|
||||
- `System.Diagnostics` (generated code attributes)
|
||||
- `System.Runtime.CompilerServices` (generated code attributes)
|
||||
- `System.ComponentModel` (`EditorBrowsableAttribute`)
|
||||
|
||||
### What depends on this module:
|
||||
- **Inferred**: XAML files within the `DTS.Viewer.TestSummaryList` module that use `{local:Translate KeyName}` syntax for localized UI strings.
|
||||
- **Inferred**: Code-behind files that access `StringResources.<PropertyName>` directly for programmatic string retrieval.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Empty Japanese resource file**: `StringResources.ja.Designer.cs` is present but empty. Japanese localization may be incomplete or handled through a different mechanism (e.g., `.resx` file without a separate designer file).
|
||||
|
||||
2. **Fallback culture behavior unclear**: The source does not show explicit fallback logic. The actual fallback behavior (e.g., defaulting to English when a culture-specific resource is missing) depends on .NET's standard resource fallback process, which is not visible in this source.
|
||||
|
||||
3. **Internal visibility**: `StringResources` is marked `internal`, limiting direct programmatic access to code within the same assembly. External assemblies must use `TranslateExtension` or another exposed mechanism.
|
||||
|
||||
4. **Trailing colons in labels**: Several properties (`ChannelCount`, `Description`, `FileDate`, `Sort`, `TestID`, `TestSetup`, `TimeStamp`, `Type`) include trailing colons and spaces in their default values. These are label strings intended for UI pairing with values, not standalone text.
|
||||
|
||||
5. **Case-sensitive key lookup**: `TranslateExtension` passes the key directly to `ResourceManager.GetString()`. Key mismatches due to case sensitivity will result in "not found" errors rather than automatic correction.
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/View/TestSummaryView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/View/TestSummaryListView.xaml.cs
|
||||
generated_at: "2026-04-16T11:17:15.115446+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a0b85470cc6f6727"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.TestSummaryList Views
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides WPF view components for displaying and interacting with test summaries in the DTS Viewer application. It contains two partial views—`TestSummaryView` and `TestSummaryListView`—both implementing `ITestSummaryListView`. The `TestSummaryListView` specifically adds keyboard interaction support for toggling test selection via the Space key. These views serve as the presentation layer for test summary data within a larger modular viewer architecture.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TestSummaryView` (class)
|
||||
**Namespace:** `DTS.Viewer.TestSummaryList`
|
||||
**Implements:** `ITestSummaryListView`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public TestSummaryView()` | Initializes the view component by calling `InitializeComponent()`. |
|
||||
|
||||
---
|
||||
|
||||
### `TestSummaryListView` (class)
|
||||
**Namespace:** `DTS.Viewer.TestSummaryList`
|
||||
**Implements:** `ITestSummaryListView`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public TestSummaryListView()` | Initializes the view component by calling `InitializeComponent()`. |
|
||||
| `TestSummary_KeyUp` | `private void TestSummary_KeyUp(object sender, KeyEventArgs e)` | Event handler that toggles the `IsSelected` property on a `TestSummary` object when the Space key is released, provided the `sender` is a `ListView` with a `TestSummary` as its `SelectedItem`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- Both view classes implement `ITestSummaryListView` from `DTS.Common.Interface`.
|
||||
- `TestSummaryListView.TestSummary_KeyUp` will only modify `IsSelected` if:
|
||||
- The `sender` can be cast to a `ListView`.
|
||||
- The `ListView.SelectedItem` can be cast to a `TestSummary` type.
|
||||
- The pressed key is `Key.Space`.
|
||||
- If any of the above conditions fail, `e.Handled` is set to `false`; otherwise, it is set to `true`.
|
||||
- The `TestSummary` class (from `DTS.Common.Classes.Viewer.TestMetadata`) must have a public `IsSelected` property that is boolean-settable.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
| Dependency | Usage |
|
||||
|------------|-------|
|
||||
| `System.Windows` | WPF framework (`FrameworkElement` base class via partial class) |
|
||||
| `System.Windows.Controls` | `ListView` control used in `TestSummary_KeyUp` |
|
||||
| `System.Windows.Input` | `Key` enum and `KeyEventArgs` for keyboard handling |
|
||||
| `DTS.Common.Interface` | `ITestSummaryListView` interface contract |
|
||||
| `DTS.Common.Classes.Viewer.TestMetadata` | `TestSummary` data class |
|
||||
| `DTS.Common.Interface.TestDefinition` | Imported in `TestSummaryListView.xaml.cs` but **not visibly used** in the code-behind |
|
||||
|
||||
### What depends on this module:
|
||||
- **Unclear from source alone.** Consumers would be modules that reference `ITestSummaryListView` or instantiate these views directly (likely via dependency injection or XAML composition in a parent view).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Misleading XML comment in `TestSummaryView.xaml.cs`:** The documentation comment states "Interaction logic for TestListView.xaml" but the class is named `TestSummaryView`. This appears to be a copy-paste error from another view.
|
||||
|
||||
2. **Unused import:** `DTS.Common.Interface.TestDefinition` is imported in `TestSummaryListView.xaml.cs` but not referenced in the code-behind. It may be used in the XAML file (not provided) or is dead code.
|
||||
|
||||
3. **Namespace directive:** The `// ReSharper disable CheckNamespace` directive in `TestSummaryListView.xaml.cs` suggests the file location may not match the declared namespace, or ReSharper was producing warnings. The actual namespace discrepancy is not apparent from the source alone.
|
||||
|
||||
4. **Two classes implementing the same interface:** Both `TestSummaryView` and `TestSummaryListView` implement `ITestSummaryListView`. The relationship between these two views (inheritance, alternative implementations, or deprecated code) is unclear from the source alone.
|
||||
@@ -0,0 +1,178 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/ViewModel/TestSummaryViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/ViewModel/TestSummaryViewListModel.cs
|
||||
generated_at: "2026-04-16T11:16:50.405785+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b27cef2360f72751"
|
||||
---
|
||||
|
||||
# Documentation: TestSummaryList ViewModels
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides two ViewModel implementations (`TestSummaryViewModel` and `TestSummaryViewListModel`) for managing and displaying test summary lists within a modular WPF application built on the Prism framework. These ViewModels serve as intermediaries between test summary data models and views, handling user interactions, data folder/file selection, filtering, sorting, and event-based communication with other application components via `IEventAggregator`. The module appears to support a data viewer scenario where users can browse, filter, and select test summaries from DTS files.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TestSummaryViewModel
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public TestSummaryViewModel(ITestSummaryListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the view's DataContext, creates interaction requests, and subscribes to `RaiseNotification` and `DataFolderChangedEvent` events.
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `void Initialize()` | Empty override. |
|
||||
| `Initialize` | `void Initialize(object parameter)` | Sets `Parent` property from parameter (cast to `IBaseWindowModel`). |
|
||||
| `Activated` | `void Activated()` | **Throws `NotImplementedException`.** |
|
||||
| `Cleanup` | `void Cleanup()` | **Throws `NotImplementedException`.** |
|
||||
| `CleanupAsync` | `Task CleanupAsync()` | **Throws `NotImplementedException`.** |
|
||||
| `InitializeAsync` | `Task InitializeAsync()` | **Throws `NotImplementedException`.** |
|
||||
| `InitializeAsync` | `Task InitializeAsync(object parameter)` | **Throws `NotImplementedException`.** |
|
||||
| `PublishSelectedTestSummaryList` | `void PublishSelectedTestSummaryList()` | Publishes `TestSummaryChangeNotification` and `TestSelectedChangedEvent` events with current selection. |
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `TestSummaryListView` | `ITestSummaryListView` | The associated view instance. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations. |
|
||||
| `ContextNavigationRegion` | `object` | Gets/sets content of `TestListRegion` on the view. |
|
||||
| `SelectedTestSummary` | `TestSummary` | Currently selected test summary. |
|
||||
| `SelectedTestSummaryList` | `List<ITestSummary>` | List of selected test summaries. |
|
||||
| `TestSummaryList` | `ObservableCollection<ITestSummary>` | Collection of all test summaries. |
|
||||
| `HeaderInfo` | `string` | Returns `"TestSummaryRegion"`. |
|
||||
| `IsBusy` | `bool` | Busy indicator state. |
|
||||
| `IsDirty` | `bool` | Dirty state flag. |
|
||||
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag. |
|
||||
|
||||
---
|
||||
|
||||
### TestSummaryViewListModel
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public TestSummaryViewListModel(ITestSummaryListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the view's DataContext, creates interaction requests, and stores dependencies.
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `void Initialize()` | Empty override. |
|
||||
| `Initialize` | `void Initialize(object parameter)` | Sets `Parent`, initializes `FilterView`, attaches collection change handlers, and subscribes to events. |
|
||||
| `Activated` | `void Activated()` | Publishes `FilterParameterChangedEvent` with empty parameter. |
|
||||
| `Cleanup` | `void Cleanup()` | Clears all test summary collections, resets `SelectedTestSummary`, and publishes selection change events. |
|
||||
| `PublishSelectedTestSummaryList` | `void PublishSelectedTestSummaryList()` | Publishes `TestSummaryChangeNotification`, `TestSummaryCountNotification`, and `ResetZoomChangedEvent` events. |
|
||||
| `OnFilterChanged` | `void OnFilterChanged(FilterParameterArgs args)` | Filters `FilteredTestSummaryList` based on `SetupName`, `Id`, or `Description` containing the parameter string (case-insensitive). |
|
||||
| `RefreshDataFolder` | `void RefreshDataFolder()` | Publishes `DataFolderChangedEvent` via dispatcher with current selected folder. |
|
||||
| `SelectDataFolder` | `void SelectDataFolder()` | Opens `OpenFileDialog` for DTS files and publishes `DataFileSelectedEvent` on selection. |
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `FilterView` | `IFilterView` | Filter view instance resolved from container. |
|
||||
| `View` | `ITestSummaryListView` | The associated view instance. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations. |
|
||||
| `ContextNavigationRegion` | `object` | Gets/sets DataContext of `TestListRegion` on the view. |
|
||||
| `IsFilterEnabled` | `bool` | Indicates if filtering is enabled (true when `TestSummaryList` has items). |
|
||||
| `SelectedTestSummary` | `TestSummary` | Currently selected test summary. |
|
||||
| `SelectedTestSummaryList` | `List<ITestSummary>` | List of selected test summaries. |
|
||||
| `TestSummaryList` | `ObservableCollection<ITestSummary>` | Collection of all test summaries; setter updates `IsFilterEnabled` and `FilteredTestSummaryList`. |
|
||||
| `FilteredTestSummaryList` | `ObservableCollection<ITestSummary>` | Filtered view of test summaries. |
|
||||
| `HeaderInfo` | `string` | Returns `"TestSummaryRegion"`. |
|
||||
| `IsBusy` | `bool` | Busy indicator state. |
|
||||
| `IsDirty` | `bool` | Dirty state flag. |
|
||||
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag. |
|
||||
| `SelectedDataFolder` | `string` | Selected data folder path; setter publishes `DataFolderChangedEvent`. |
|
||||
| `SelectedDataFile` | `string` | Selected data file path; setter publishes `DataFolderChangedEvent`. |
|
||||
| `SortableAttributes` | `List<string>` | List of localized sortable attribute names. |
|
||||
| `SelectedSortIndex` | `int` | Index of selected sort attribute; setter triggers `SortTestSummaryList()`. |
|
||||
|
||||
**Commands:**
|
||||
| Command | Type | Description |
|
||||
|---------|------|-------------|
|
||||
| `RefreshDataFolderCommand` | `DelegateCommand` | Refreshes the current data folder. |
|
||||
| `SelectDataFolderCommand` | `DelegateCommand` | Opens file dialog to select a DTS file. |
|
||||
|
||||
**Nested Types:**
|
||||
- `SortableAttribute` (enum): `TimeStampDescending`, `Timestamp`, `FileDateDescending`, `FileDate`, `IdDescending`, `Id`, `TestSetupDescending`, `TestSetup`
|
||||
- `SortableAttributeHelper` (class): Helper for converting `SortableAttribute` to localized string via `StringResources.ResourceManager`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Event Subscription Timing**: Both ViewModels subscribe to events in their constructors. `TestSummaryViewListModel` additionally calls `Subscribe()` during `Initialize(object parameter)`.
|
||||
|
||||
2. **Parent Parameter Casting**:
|
||||
- `TestSummaryViewModel.Initialize(object parameter)` casts to `IBaseWindowModel`
|
||||
- `TestSummaryViewListModel.Initialize(object parameter)` casts to `IBaseViewModel`
|
||||
|
||||
3. **Collection Synchronization**: In `TestSummaryViewListModel`, setting `TestSummaryList` automatically updates `FilteredTestSummaryList` and `IsFilterEnabled`.
|
||||
|
||||
4. **Property Change Propagation**: `TestSummaryViewListModel.TestSummaryList_CollectionChanged` attaches/detaches `PropertyChanged` handlers to items implementing `INotifyPropertyChanged`.
|
||||
|
||||
5. **Sorting Behavior**: `SortTestSummaryList()` clears and repopulates `FilteredTestSummaryList` in-place based on `SelectedSortIndex`.
|
||||
|
||||
6. **Filter Matching**: `OnFilterChanged` performs case-insensitive `Contains` matching on `SetupName`, `Id`, and `Description` fields.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (from imports):
|
||||
- **Prism Framework**: `Microsoft.Practices.Prism.Events`, `Microsoft.Practices.Prism.Interactivity.InteractionRequest`, `Microsoft.Practices.Prism.Regions`, `Prism.Events`, `Prism.Regions`, `Prism.Commands`
|
||||
- **Unity**: `Microsoft.Practices.Unity`, `Unity`
|
||||
- **System.Windows.Forms**: Used for `OpenFileDialog` in `TestSummaryViewListModel.SelectDataFolder()`
|
||||
|
||||
### Internal Dependencies (DTS.* namespaces):
|
||||
- `DTS.Common.Base` (`BaseViewModel<T>`)
|
||||
- `DTS.Common.Classes.TestMetadata` (`TestSummary`)
|
||||
- `DTS.Common.Classes.Viewer.TestMetadata`
|
||||
- `DTS.Common.Events` (`RaiseNotification`, `DataFolderChangedEvent`, `TestSummaryChangeNotification`, `TestSelectedChangedEvent`, `ShowStatus`, `FilterParameterChangedEvent`, `RefreshTestRequestEvent`, `TestSummaryCountNotification`, `ResetZoomChangedEvent`, `DataFileSelectedEvent`)
|
||||
- `DTS.Common.Interface` (`IBaseWindowModel`, `IBaseViewModel`, `IFilterView`, `IFilterViewModel`)
|
||||
- `DTS.Common.Interface.TestDefinition` (`ITestSummary`, `ITestSummaryListViewModel`, `ITestSummaryListView`)
|
||||
- `DTS.Common.Interactivity`
|
||||
- `DTS.Viewer.TestSummaryList.Model` (`TestSummaryModel`)
|
||||
- `DTS.Viewer.TestSummaryList.Resources` (`StringResources`)
|
||||
|
||||
### Dependents:
|
||||
- Views: `TestSummaryView`, `TestSummaryListView` (referenced via casting in `ContextNavigationRegion` properties)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Stale XML Documentation**: The constructor XML comment in `TestSummaryViewModel` states "Creates a new instance of the TechnologyDoFrontEditViewModel" — this appears to be a copy-paste error from another ViewModel.
|
||||
|
||||
2. **NotImplementedException Methods**: In `TestSummaryViewModel`, the following methods throw `NotImplementedException`:
|
||||
- `Activated()`
|
||||
- `Cleanup()`
|
||||
- `CleanupAsync()`
|
||||
- `InitializeAsync()`
|
||||
- `InitializeAsync(object parameter)`
|
||||
|
||||
These indicate incomplete implementation or placeholder code.
|
||||
|
||||
3. **Member Hiding with `new` Keyword**: Both ViewModels use `new` to hide inherited members (`PropertyChanged`, `OnPropertyChanged`, `IsBusy`, `IsDirty`, `IsNavigationIncluded`). This can lead to unexpected behavior when casting to base types.
|
||||
|
||||
4. **Inconsistent Event Signatures**:
|
||||
- `TestSummaryViewModel.OnDataFolderChanged(string path)` takes a `string` parameter
|
||||
- `TestSummaryViewListModel.OnDataFolderChanged(DataFolderSelectionArg arg)` takes a `DataFolderSelectionArg` parameter
|
||||
|
||||
Both subscribe to `DataFolderChangedEvent`, suggesting the event payload type changed or the ViewModels are used in different contexts.
|
||||
|
||||
5. **WinForms Interop in WPF**: `TestSummaryViewListModel.SelectDataFolder()` uses `System.Windows.Forms.OpenFileDialog` rather than a WPF dialog, requiring WinForms integration.
|
||||
|
||||
6. **Internal Field Assignment**: Both ViewModels create `TestSummaryModel` instances and set the private `_eventAggregator` field directly (e.g., `td._eventAggregator = _eventAggregator`), which bypasses encapsulation and suggests tight coupling.
|
||||
|
||||
7. **Typo in Property Name**: `TestSummaryViewListModel._selctedSortIndex` (missing 'e' in "selected") — minor but could cause confusion during debugging.
|
||||
Reference in New Issue
Block a user