init
This commit is contained in:
117
enriched-partialglm/DTS Viewer/DTS.Viewer/Classes.md
Normal file
117
enriched-partialglm/DTS Viewer/DTS.Viewer/Classes.md
Normal file
@@ -0,0 +1,117 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/Classes/MenuItem.cs
|
||||
- DTS Viewer/DTS.Viewer/Classes/TabItem.cs
|
||||
- DTS Viewer/DTS.Viewer/Classes/NavigationItem.cs
|
||||
- DTS Viewer/DTS.Viewer/Classes/BindingProxy.cs
|
||||
- DTS Viewer/DTS.Viewer/Classes/ComplonentsGroupControl.cs
|
||||
generated_at: "2026-04-16T11:22:34.808193+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e704fa30e232a4ba"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer Classes
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a collection of UI support classes for the DTS Viewer WPF application. It includes data binding helpers (`BindingProxy`), custom controls (`ComponentsGroupControl`), and placeholder model classes (`MenuItem`, `TabItem`, `NavigationItem`) that appear to support the application's navigation and presentation layer. The module exists to enable XAML-specific features like data binding in non-visual contexts and to provide reusable UI components.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DTS.Viewer.BindingProxy`
|
||||
|
||||
A `Freezable`-derived class that enables data binding in contexts where the DataContext is not naturally inherited (e.g., from within a Style or DataTrigger).
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `DataProperty` | `public static readonly DependencyProperty` | Dependency property backing store for `Data`. Registered with name `"Data"`, type `object`, owner type `BindingProxy`. |
|
||||
| `Data` | `public object Data { get; set; }` | Gets or sets an arbitrary data object for binding purposes. Uses `GetValue`/`SetValue` on `DataProperty`. |
|
||||
| `CreateInstanceCore` | `protected override Freezable CreateInstanceCore()` | Required override for `Freezable`. Returns a new instance of `BindingProxy`. |
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Viewer.ComponentsGroupControl`
|
||||
|
||||
A custom `Control` for displaying a grouped component with an image and title.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ClickEventArgs` | `public class ClickEventArgs : EventArgs` | Nested class for click event arguments. Contains only a default constructor. |
|
||||
| `ClickCommand` | `public static RoutedCommand ClickCommand { get; }` | Static routed command named `"ClickCommand"`. Returns the private `_click` field. |
|
||||
| `ImageProperty` | `public static readonly DependencyProperty ImageProperty` | Dependency property for the `Image` property. Type `ImageSource`, default value `null`. |
|
||||
| `Image` | `public ImageSource Image { get; set; }` | Gets or sets the image source displayed by the control. |
|
||||
| `TitleProperty` | `public static readonly DependencyProperty TitleProperty` | Dependency property for the `Title` property. Type `string`, default value `"Title"`. |
|
||||
| `Title` | `public string Title { get; set; }` | Gets or sets the title text displayed by the control. |
|
||||
|
||||
**Private/Static Members:**
|
||||
- `private static RoutedCommand _click` — Backing field for `ClickCommand`.
|
||||
- `private static void OnCommandExecute(object sender, ExecutedRoutedEventArgs e)` — Command handler; casts sender to `ComponentsGroupControl` but performs no further action.
|
||||
- `private static void InitializeCommands()` — Registers the `ClickCommand` with `CommandManager`.
|
||||
- `static ComponentsGroupControl()` — Static constructor that overrides `DefaultStyleKeyProperty` metadata and initializes commands.
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Viewer.MenuItem`
|
||||
|
||||
An empty internal class with no members. Purpose unclear from source alone.
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Viewer.Classes.TabItem`
|
||||
|
||||
An empty internal class with no members. Purpose unclear from source alone.
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Viewer.Classes.NavigationItem`
|
||||
|
||||
An empty public class with no members. Purpose unclear from source alone.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **BindingProxy**: As a `Freezable` subclass, `CreateInstanceCore()` must always return a new instance of `BindingProxy` (currently satisfied).
|
||||
- **ComponentsGroupControl**:
|
||||
- The static constructor always runs before any instance is created, ensuring `DefaultStyleKeyProperty` metadata is overridden and commands are registered.
|
||||
- `Title` property defaults to the string `"Title"` (via `UIPropertyMetadata`).
|
||||
- `Image` property defaults to `null`.
|
||||
- **Dependency Properties**: All dependency properties follow WPF conventions—registered with correct owner types and accessed via `GetValue`/`SetValue`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Imports (What this module depends on):
|
||||
|
||||
| Class | Dependencies |
|
||||
|-------|--------------|
|
||||
| `BindingProxy` | `System.Windows` (Freezable, DependencyProperty) |
|
||||
| `ComponentsGroupControl` | `System`, `System.Windows`, `System.Windows.Controls`, `System.Windows.Input`, `System.Windows.Media` |
|
||||
| `MenuItem`, `TabItem`, `NavigationItem` | None (no imports) |
|
||||
|
||||
### Dependents (What depends on this module):
|
||||
|
||||
**Cannot be determined from source alone.** These classes are likely referenced by XAML files, view models, or other code files not provided in this source set.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`ComponentsGroupControl.OnCommandExecute` does nothing useful**: The method casts the sender to `ComponentsGroupControl` but performs no action afterward. The actual click handling logic is either missing or expected to be implemented elsewhere (possibly in XAML or a code-behind not shown).
|
||||
|
||||
2. **Commented-out code in `ComponentsGroupControl`**: Several members are commented out:
|
||||
- `SubtitleProperty` and `Subtitle` property
|
||||
- `TabItemProperty` and `TabItem` property (referencing a type `DataModel.TabPageItem`)
|
||||
- `ClickEventHandler` delegate and `OnClicked` event
|
||||
|
||||
This suggests incomplete refactoring or features that were started but not finished.
|
||||
|
||||
3. **Empty placeholder classes**: `MenuItem`, `TabItem`, and `NavigationItem` have no members whatsoever. They may be stubs awaiting implementation, used only as markers in XAML, or remnants of abandoned development.
|
||||
|
||||
4. **Namespace inconsistency**: `MenuItem` is in `DTS.Viewer` namespace, while `TabItem` and `NavigationItem` are in `DTS.Viewer.Classes`. This inconsistency may cause confusion when locating classes.
|
||||
|
||||
5. **`ClickEventArgs` is defined but never used**: The nested `ClickEventArgs` class exists in `ComponentsGroupControl`, but the associated event (`OnClicked`) is commented out, making this class currently unused.
|
||||
139
enriched-partialglm/DTS Viewer/DTS.Viewer/Modules/Main/View.md
Normal file
139
enriched-partialglm/DTS Viewer/DTS.Viewer/Modules/Main/View.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/MainView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/ViewerShellView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/MainViewLite.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/ExportMainView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/ViewerMainView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/ExportMainViewGrid.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/View/ViewerMainViewGrid.xaml.cs
|
||||
generated_at: "2026-04-16T11:26:12.276849+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a7a3a3c725d7b68b"
|
||||
---
|
||||
|
||||
# DTS Viewer Main Views Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module contains the WPF view code-behind files for the main window and viewer components of the DTS Viewer application. It provides multiple view variants (standard, lite, export, and viewer modes) that implement a view-first MVVM architecture using Prism. The views handle UI initialization, event subscription for graph loading notifications, and PDF/image export functionality. These views serve as the visual containers for the application's primary user interface elements.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### MainView
|
||||
```csharp
|
||||
public partial class MainView : IMainView
|
||||
```
|
||||
- **Constructor**: `MainView()` - Initializes the WPF component via `InitializeComponent()`.
|
||||
- Implements `IMainView` interface from `DTS.Common.Interface`.
|
||||
|
||||
### ViewerShellView
|
||||
```csharp
|
||||
public partial class ViewerShellView : IViewerShellView
|
||||
```
|
||||
- **Constructor**: `ViewerShellView()` - Initializes the WPF component via `InitializeComponent()`.
|
||||
- Implements `IViewerShellView` interface from `DTS.Common.Interface`.
|
||||
|
||||
### MainViewLite
|
||||
```csharp
|
||||
public partial class MainViewLite : IMainViewerView
|
||||
```
|
||||
- **Constructor**: `MainViewLite()` - Initializes the WPF component via `InitializeComponent()`.
|
||||
- Implements `IMainViewerView` interface from `DTS.Common.Interface`.
|
||||
|
||||
### ExportMainView
|
||||
```csharp
|
||||
public partial class ExportMainView : IExportMainView
|
||||
```
|
||||
- **Constructor**: `ExportMainView()` - Initializes the WPF component via `InitializeComponent()`.
|
||||
- Implements `IExportMainView` interface from `DTS.Common.Interface`.
|
||||
|
||||
### ViewerMainView
|
||||
```csharp
|
||||
public partial class ViewerMainView : IViewerMainView
|
||||
```
|
||||
- **Constructor**: `ViewerMainView()` - Initializes the WPF component via `InitializeComponent()`.
|
||||
- Implements `IViewerMainView` interface from `DTS.Common.Interface`.
|
||||
- Contains commented-out code for AvalonDock layout serialization/deserialization (referencing `DockManager`, `XmlLayoutSerializer`, and `DataProViewerAvalonDock.config`).
|
||||
|
||||
### ExportMainViewGrid
|
||||
```csharp
|
||||
public partial class ExportMainViewGrid : IExportMainViewGrid
|
||||
```
|
||||
- **Constructor**: `ExportMainViewGrid()` - Initializes component and subscribes to `Loaded` event.
|
||||
- Implements `IExportMainViewGrid` interface from `DTS.Common.Interface`.
|
||||
- **Public Method**: `int SaveToPDF(string directory, string pdfFileName)` - Renders the view to PDF and PNG files. Returns `> 0` on success, `< 0` on failure, or `0` if `MainShell` is not yet rendered.
|
||||
- **Private Property**: `IEventAggregator _eventAggregator` - Resolved from container on load.
|
||||
- **Private Method**: `void SetFocus()` - Empty implementation (no operation).
|
||||
- **Private Method**: `void ExportMainViewGrid_Loaded(object sender, RoutedEventArgs e)` - Resolves `IEventAggregator` and subscribes to `GraphLoadedCountNotification`.
|
||||
- **Private Method**: `void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg)` - Delays 3 seconds then invokes `SetFocus` via dispatcher.
|
||||
|
||||
### ViewerMainViewGrid
|
||||
```csharp
|
||||
public partial class ViewerMainViewGrid : IViewerMainViewGrid
|
||||
```
|
||||
- **Constructor**: `ViewerMainViewGrid()` - Initializes component and subscribes to `Loaded` event.
|
||||
- Implements `IViewerMainViewGrid` interface from `DTS.Common.Interface`.
|
||||
- **Public Method**: `int SaveToPDF(string directory, string pdfFileName)` - Renders the view to PDF and PNG files. Returns `> 0` on success, `< 0` on failure, or `0` if `MainShell` is not yet rendered.
|
||||
- **Private Property**: `IEventAggregator _eventAggregator` - Resolved from container on load.
|
||||
- **Private Method**: `void SetFocus()` - Selects and focuses `chartOptTab` element.
|
||||
- **Private Method**: `void ViewerMainViewGrid_Loaded(object sender, RoutedEventArgs e)` - Resolves `IEventAggregator` and subscribes to `GraphLoadedCountNotification`.
|
||||
- **Private Method**: `void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg)` - Validates `DataContext` matches `arg.ParentVM`, delays 3 seconds, then invokes `SetFocus` via dispatcher.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- All views must call `InitializeComponent()` in their constructor (WPF code-behind requirement).
|
||||
- `SaveToPDF` requires `pdfFileName` to end with `.pdf` extension; otherwise returns `-1`.
|
||||
- `SaveToPDF` requires both `directory` and `pdfFileName` to be non-null and non-empty; otherwise returns `-1`.
|
||||
- `SaveToPDF` returns `0` if `MainShell.DesiredSize.Height` or `MainShell.DesiredSize.Width` is `0` (control not yet rendered).
|
||||
- `OnGraphLoadedCountNotification` only processes the event if `DataContext` is non-null and matches `arg.ParentVM` (cast to `IBaseViewModel`).
|
||||
- Event subscription to `GraphLoadedCountNotification` occurs only after the `Loaded` event fires (ensures `IEventAggregator` is available).
|
||||
- PDF export renders at 300 DPI resolution.
|
||||
- PNG export is generated alongside PDF with `.pdf` extension replaced by `.png`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies
|
||||
- **Prism.Events** - `IEventAggregator` for pub/sub event messaging.
|
||||
- **Prism.Ioc** - `ContainerLocator` for service location.
|
||||
- **C1.WPF.Pdf** - `C1PdfDocument` for PDF generation (ComponentOne library).
|
||||
- **System.Windows** - WPF core types (`RoutedEventArgs`, `Visual`, `Dispatcher`, etc.).
|
||||
- **System.Windows.Media** - `RenderTargetBitmap`, `WriteableBitmap`, `PixelFormats`, `VisualTreeHelper`.
|
||||
- **System.Windows.Media.Imaging** - Bitmap rendering types.
|
||||
|
||||
### Internal Dependencies
|
||||
- **DTS.Common.Interface** - Interface definitions (`IMainView`, `IViewerShellView`, `IMainViewerView`, `IExportMainView`, `IViewerMainView`, `IExportMainViewGrid`, `IViewerMainViewGrid`).
|
||||
- **DTS.Common.Base** - `IBaseViewModel` base interface.
|
||||
- **DTS.Common.Events** - `GraphLoadedCountNotification` event and `GraphLoadedCountNotificationArg` argument class.
|
||||
- **DTS.Common.Utilities.Logging** - `APILogger.LogException(Exception)` for error logging.
|
||||
- **DTS.Common.Utils.PNGImageUtil** - `SaveImage(FrameworkElement, string)` static method for PNG export.
|
||||
|
||||
### Consumers
|
||||
- Unknown from source alone. These views are likely instantiated by a Prism bootstrapper or module initialization logic.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Hardcoded 3-second delay**: Both `ExportMainViewGrid` and `ViewerMainViewGrid` use `Thread.Sleep(TimeSpan.FromSeconds(3))` before setting focus. This is a magic number with no configuration, potentially causing timing issues on slower systems.
|
||||
|
||||
2. **Empty SetFocus in ExportMainViewGrid**: The `SetFocus()` method in `ExportMainViewGrid` is empty, making the 3-second delayed focus operation a no-op. This may be intentional or dead code.
|
||||
|
||||
3. **Commented-out AvalonDock code**: `ViewerMainView` contains significant commented-out code for layout serialization using `XmlLayoutSerializer` and a `DockManager` element. This suggests either incomplete feature implementation or removed functionality that wasn't cleaned up.
|
||||
|
||||
4. **Multiple ReSharper disable directives**: `ExportMainView`, `ViewerMainView`, `ExportMainViewGrid`, and `ViewerMainViewGrid` all suppress multiple ReSharper inspections, which may mask potential code quality issues.
|
||||
|
||||
5. **Namespace inconsistency**: All files declare namespace `DTS.Viewer` despite residing in different subdirectories (e.g., `Modules/Main/View/`). This is intentional but may cause confusion when locating files.
|
||||
|
||||
6. **Event subscription without unsubscription**: Neither `ExportMainViewGrid` nor `ViewerMainViewGrid` unsubscribe from `GraphLoadedCountNotification`. This could cause memory leaks if views are created/destroyed frequently.
|
||||
|
||||
7. **PDF return value semantics**: The `SaveToPDF` method uses a tri-state return value (`>0`, `0`, `<0`) which is documented but unconventional. Callers must check for `> 0` rather than a simple boolean.
|
||||
|
||||
8. **Silent exception handling**: `SaveToPDF` catches all exceptions, logs them via `APILogger.LogException`, and returns `-1`. The caller receives no exception details.
|
||||
@@ -0,0 +1,271 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/ViewModel/ViewerShellViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/ViewModel/MainViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/Modules/Main/ViewModel/ExportMainViewModel.cs
|
||||
generated_at: "2026-04-16T11:26:44.035903+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ab73d8a45f8ea2f6"
|
||||
---
|
||||
|
||||
# DTS Viewer Main Module ViewModels Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module contains the core ViewModel classes for the DTS Viewer application's main shell and primary views. It implements the MVVM pattern using Microsoft Prism and Unity IoC container. The module orchestrates region management, event aggregation for cross-component communication, and view composition for the main application shell, standard viewer mode, and export-focused mode. The ViewModels serve as the presentation logic layer, binding views to data, handling user interactions via commands, and coordinating child view instantiation within named UI regions.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ViewerShellViewModel
|
||||
**Location:** `DTS.Viewer.Modules.Main.ViewModel`
|
||||
|
||||
**Class Declaration:**
|
||||
```csharp
|
||||
[Export(typeof(IShellView))]
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class ViewerShellViewModel : NotificationObject, IViewerShellViewModel
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public ViewerShellViewModel(IViewerShellView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the shell view model, sets the View's DataContext, creates interaction requests, subscribes to `RaiseNotification` events, and registers `IMainView`/`MainView` and `IMainViewModel`/`MainViewModel` with the Unity container.
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `View` | `IViewerShellView` | Gets the associated shell view |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notification dialogs |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmation dialogs |
|
||||
| `ContextMainRegion` | `Object` | Gets/sets the content of the MainRegion |
|
||||
| `IsMenuIncluded` | `bool` | Indicates whether menu is included |
|
||||
| `IsNavigationIncluded` | `bool` | Indicates whether navigation is included |
|
||||
| `HeaderInfo` | `string` | Returns `"MainRegion"` |
|
||||
| `IsBusy` | `bool` | **Throws `NotImplementedException`** |
|
||||
| `IsDirty` | `bool` | **Throws `NotImplementedException`** |
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `void Initialize()` | Stub implementation (sets local `i = 10`) |
|
||||
| `Initialize` | `void Initialize(object parameter)` | Stub implementation (sets local `i = 22`) |
|
||||
| `Initialize` | `void Initialize(object parameter, object model)` | Empty stub |
|
||||
| `Activated` | `void Activated()` | Empty stub |
|
||||
| `Cleanup` | `void Cleanup()` | **Throws `NotImplementedException`** |
|
||||
| `CleanupAsync` | `Task CleanupAsync()` | **Throws `NotImplementedException`** |
|
||||
| `InitializeAsync` | `Task InitializeAsync()` | **Throws `NotImplementedException`** |
|
||||
| `InitializeAsync` | `Task InitializeAsync(object parameter)` | **Throws `NotImplementedException`** |
|
||||
| `GetRegions` | `List<FrameworkElement> GetRegions()` | Returns all elements named "Region" in the MainShell |
|
||||
| `OnRaiseNotification` | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Private handler that raises `NotificationRequest` with transformed args |
|
||||
|
||||
---
|
||||
|
||||
### MainViewModel
|
||||
**Location:** `DTS.Viewer.Modules.Main.ViewModel`
|
||||
|
||||
**Class Declaration:**
|
||||
```csharp
|
||||
public class MainViewModel : BaseViewModel<IMainViewModel>, IMainViewModel
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public MainViewModel(IMainView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the view model, sets DataContext, creates interaction requests, and subscribes to `RaiseNotification` event.
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `override void Initialize()` | Empty override |
|
||||
| `Initialize` | `override void Initialize(object parameter)` | Sets `Parent`, propagates menu/navigation flags, subscribes to `AssemblyListNotification` and `BusyIndicatorChangeNotification` events |
|
||||
| `Activated` | `override void Activated()` | Empty override |
|
||||
| `GetRegions` | `List<FrameworkElement> GetRegions()` | Returns all elements named "Region" in MainShell |
|
||||
|
||||
**Private Methods:**
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `OnAssemblyListChange(AssemblyListInfo e)` | Processes assembly custom attributes ending with "ImageAttribute", creates `AssemblyNameImage` objects, and populates regions based on `eAssemblyRegion` enum |
|
||||
| `OnRaiseNotification(NotificationContentEventArgs)` | Raises `NotificationRequest` with transformed content |
|
||||
| `OnBusyIndicatorNotification(bool eventArg)` | Sets `IsBusy` property |
|
||||
| `GetNavigationView(IBaseViewModel)` | Resolves and initializes `INavigationView`/`INavigationViewModel` |
|
||||
| `GetPropertyView(IBaseWindowModel)` | Resolves and initializes `IPropertyView`/`IPropertyViewModel` |
|
||||
| `GetGraphView(IBaseWindowModel)` | Resolves and initializes `IGraphView`/`IGraphViewModel` |
|
||||
|
||||
**Region Context Properties:**
|
||||
| Property | Region Name |
|
||||
|----------|-------------|
|
||||
| `ContextNavigationRegion` | NavigationRegion |
|
||||
| `ContextGraphRegion` | GraphRegion |
|
||||
| `ContextTestsRegion` | TestsRegion |
|
||||
| `ContextGraphsRegion` | GraphsRegion |
|
||||
| `ContextLegendRegion` | LegendRegion |
|
||||
| `ContextDiagRegion` | DiagRegion |
|
||||
| `ContextStatsRegion` | StatsRegion |
|
||||
| `ContextCursorRegion` | CursorRegion |
|
||||
| `ContextPropertyRegion` | PropertyRegion |
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `View` | `IBaseView` | The associated view |
|
||||
| `IsBusy` | `bool` | Busy indicator state |
|
||||
| `IsBusyMessage` | `string` | Message for busy indicator |
|
||||
| `IsMenuIncluded` | `bool` | Menu inclusion flag |
|
||||
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag |
|
||||
| `HeaderInfo` | `string` | Returns `"MainRegion"` |
|
||||
|
||||
---
|
||||
|
||||
### ExportMainViewModel
|
||||
**Location:** `DTS.Viewer.Modules.Main.ViewModel`
|
||||
|
||||
**Class Declaration:**
|
||||
```csharp
|
||||
public class ExportMainViewModel : BaseViewModel<IExportMainViewModel>, IExportMainViewModel
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public ExportMainViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes interaction requests, resolves `IExportMainViewGrid` as the View, and sets DataContext.
|
||||
|
||||
**Key Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `View` | `IBaseView` | Gets/sets the view (resolved as `IExportMainViewGrid`) |
|
||||
| `Standalone` | `bool` | Determines whether to use `ExportMainView` or `ExportMainViewGrid` |
|
||||
| `SelectedTest` | `string` | Currently selected test |
|
||||
| `SelectedDTSFile` | `string` | Currently selected DTS file |
|
||||
| `SelectedEventList` | `List<ITestEvent>` | List of selected test events |
|
||||
| `AvailableTestIds` | `List<string>` | Available test IDs |
|
||||
| `SettingsVisibility` | `Visibility` | Controls settings panel visibility |
|
||||
| `ActiveContent` | `IBaseViewModel` | Currently active content |
|
||||
| `TotalSelectedTests` | `int` | Count of selected tests |
|
||||
| `TotalLoadedTests` | `int` | Count of loaded tests |
|
||||
| `TotalSelectedGraphs` | `int` | Count of selected graphs |
|
||||
| `TotalLoadedGraphs` | `int` | Count of loaded graphs |
|
||||
| `SelectedDataFolder` | `string` | Selected data folder path |
|
||||
| `SelectedDataFile` | `string` | Selected data file |
|
||||
| `ShowModifications` | `bool` | Indicates if modifications should be shown |
|
||||
| `ChannelCodeViewMode` | `IsoViewMode` | Channel code display mode (default: `IsoViewMode.ISOAndUserCode`) |
|
||||
| `CalibrationBehaviorSetting` | `CalibrationBehaviors` | Calibration behavior (default: `CalibrationBehaviors.NonLinearIfAvailable`) |
|
||||
| `CalibrationBehaviorSettableInViewer` | `bool` | Whether calibration behavior is settable (default: `true`) |
|
||||
| `DoesUserHaveEditPermission` | `bool` | User edit permission flag (default: `false`) |
|
||||
| `ConfigPath` | `string` | Configuration path |
|
||||
| `IsBusy` | `bool` | Busy indicator state |
|
||||
| `IsBusyMessage` | `string` | Busy indicator message |
|
||||
| `IsMenuIncluded` | `bool` | Menu inclusion flag |
|
||||
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag |
|
||||
| `HeaderInfo` | `string` | Returns `"MainRegion"` |
|
||||
|
||||
**Commands:**
|
||||
| Command | CanExecute Condition | Action |
|
||||
|---------|---------------------|--------|
|
||||
| `LoadLayoutCommand` | `File.Exists(@".\DataProViewerAvalonDock.config")` | Deserializes AvalonDock layout from config file |
|
||||
| `SaveLayoutCommand` | Always `true` | Serializes AvalonDock layout to `.\AvalonDock.config` |
|
||||
|
||||
**Public Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `override void Initialize()` | Calls `Subscribe()` to register event handlers |
|
||||
| `Initialize` | `override void Initialize(object parameter)` | Sets `Parent`, propagates flags, calls `Subscribe()` |
|
||||
| `Activated` | `override void Activated()` | Empty override |
|
||||
| `AddSelectedEvents` | `void AddSelectedEvents(string groupName, List<ITestEvent> events)` | Adds events to `SelectedEventList`, publishes busy indicator events |
|
||||
| `SelectAndIncludeDataFile` | `void SelectAndIncludeDataFile(string value)` | Sets selected data file and publishes `DataFolderChangedEvent` |
|
||||
| `ZoomReset` | `void ZoomReset()` | Publishes `ResetZoomChangedEvent` with `true` |
|
||||
| `LeftKeyPress` | `void LeftKeyPress()` | Publishes `ShiftT0Event` with `-1` step |
|
||||
| `RightKeyPress` | `void RightKeyPress()` | Publishes `ShiftT0Event` with `+1` step |
|
||||
| `GetRegions` | `List<FrameworkElement> GetRegions()` | Returns regions based on `Standalone` mode |
|
||||
|
||||
**Private Event Handlers:**
|
||||
| Method | Event Subscribed |
|
||||
|--------|-----------------|
|
||||
| `OnDataFileSelected` | `DataFileSelectedEvent` |
|
||||
| `OnViewerSettingsVisibilityChanged` | `ViewerSettingsVisibilityChangedEvent` |
|
||||
| `OnGraphLoadedCountChanged` | `GraphLoadedCountNotification` |
|
||||
| `OnGraphSelectedCountChanged` | `GraphSelectedEventCountNotification` |
|
||||
| `OnGraphChannelsReadCompleted` | `GraphChannelsReadCompletedNotification` (UIThread) |
|
||||
| `OnTestLoadedChanged` | `TestLoadedCountNotification` |
|
||||
| `OnTestSelectedCountChanged` | `TestSummaryCountNotification` |
|
||||
| `OnLoadExportModule` | `LoadExportModuleEvent` |
|
||||
| `OnShiftT0Event` | `ShiftT0Event` |
|
||||
| `OnSaveToPDFRequested` | `SaveToPDFRequestedEvent` |
|
||||
|
||||
**View Factory Methods:**
|
||||
| Method | Returns |
|
||||
|--------|---------|
|
||||
| `GetGraphView(IBaseViewModel)` | `IGraphView` with initialized `IGraphViewModel` |
|
||||
| `GetGraphListView(IBaseViewModel)` | `IExportGraphMainView` with initialized `IExportGraphMainViewModel` |
|
||||
| `GetTestDefinitionView(IBaseViewModel)` | `ITestSummaryListView` with initialized `ITestSummaryListViewModel` |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **View-ViewModel Binding**: Each ViewModel sets `View.DataContext = this` in its constructor, establishing the binding invariant.
|
||||
|
||||
2. **Region Content Access**: All `ContextXxxRegion` properties cast the `View` to a concrete type (`MainView`, `ViewerShellView`, `ExportMainView`, or `ExportMainViewGrid`) before accessing region content. The view must be of the expected type.
|
||||
|
||||
3. **Parent Parameter Type**: In `MainViewModel.Initialize(object parameter)` and `ExportMainViewModel.Initialize(object parameter)`, the parameter is cast to `IBaseWindowModel` without type checking.
|
||||
|
||||
4. **Standalone Mode Switching**: `ExportMainViewModel` requires `Standalone` to be set correctly before accessing region properties, as it determines whether to cast to `ExportMainView` or `ExportMainViewGrid`.
|
||||
|
||||
5. **Event Subscription Pattern**: ViewModels subscribe to events in constructors or `Initialize` methods; unsubscribing is not visible in the source.
|
||||
|
||||
6. **Property Change Notification**: All setters that modify bound properties call `OnPropertyChanged(string)` with the property name.
|
||||
|
||||
7. **Unity Container Registration**: `ViewerShellViewModel` registers `IMainViewModel` with `ContainerControlledLifetimeManager`, making it a singleton.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (from imports):
|
||||
- `Microsoft.Practices.Prism.Events` - `IEventAggregator`, `ThreadOption`
|
||||
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` - `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- `Microsoft.Practices.Prism.Regions` - `IRegionManager`
|
||||
- `Microsoft.Practices.Prism.ViewModel` - `NotificationObject`
|
||||
- `Microsoft.Practices.Unity` - `IUnityContainer`, `ContainerControlledLifetimeManager`
|
||||
- `System.ComponentModel.Composition` - `[Export]`, `[PartCreationPolicy]`, `CreationPolicy`
|
||||
- `Xceed.Wpf.AvalonDock.Layout.Serialization` - `XmlLayoutSerializer` (ExportMainViewModel only)
|
||||
- `Prism.Events` - Used in ExportMainViewModel alongside older Prism namespace
|
||||
- `Prism.Regions` - Used in ExportMainViewModel alongside older Prism namespace
|
||||
- `Unity` - Used in ExportMainViewModel alongside older Unity namespace
|
||||
|
||||
### Internal Dependencies:
|
||||
- `DTS.Common.Base` - `BaseViewModel<T>`, `IBaseViewModel`, `IBaseView`, `IBaseWindowModel`
|
||||
- `DTS.Common.Events` - Event types: `RaiseNotification`, `AssemblyListNotification`, `BusyIndicatorChangeNotification`, `DataFolderChangedEvent`, `LoadExportModuleEvent`, `TestLoadedCountNotification`, `TestSummaryCountNotification`, `GraphLoadedCountNotification`, `ShiftT0Event`, `GraphSelectedEventCountNotification`, `GraphChannelsReadCompletedNotification`, `ViewerSettingsVisibilityChangedEvent`, `DataFileSelectedEvent`, `SaveToPDFRequestedEvent`, `ChannelCodesViewChangedEvent`, `ExportCalibrationBehaviorSettingChangedEvent`, `CalibrationBehaviorSettableInViewerChangedEvent`, `ResetZoomChangedEvent`, `PageErrorEvent`
|
||||
- `DTS.Common.Interface` - Various view/viewmodel interfaces: `IMainView`, `IMainViewModel`, `IViewerShellView`, `IViewerShellViewModel`, `INavigationView`, `INavigationViewModel`, `IPropertyView`, `IPropertyViewModel`, `IGraphView`, `IGraphViewModel`, `IExportMainViewGrid`, `IExportMainViewModel`, `IExportGraphMainView`, `IExportGraphMainViewModel`, `ITestSummaryListView`, `ITestSummaryListViewModel`, `ITestEvent`
|
||||
- `DTS.Common.Utils` - `Utils.GetChildrenByName()`
|
||||
- `DTS.Common.Enums` - `eAssemblyRegion`
|
||||
- `DTS.Common.Enums.Sensors` - `IsoViewMode`, `CalibrationBehaviors`
|
||||
- `DTS.Common.Classes.Viewer.Commands` - `RelayCommand`
|
||||
- `DTS.Common.Interactivity` - (imported but usage unclear)
|
||||
- `DTS.Viewer.Resources` - `StringResources`
|
||||
|
||||
### View Dependencies (referenced but not provided):
|
||||
- `ViewerShellView`, `MainView`, `ExportMainView`, `ExportMainViewGrid`
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **NotImplementedException Throwing Members**: `ViewerShellViewModel` has multiple members that throw `NotImplementedException`:
|
||||
- `IsBusy` getter
|
||||
- `IsDirty` getter
|
||||
- `Cleanup()`
|
||||
- `CleanupAsync()`
|
||||
- `InitializeAsync()`
|
||||
- `InitializeAsync(object parameter)`
|
||||
|
||||
These appear to be interface implementations that were never completed. Calling code must avoid these.
|
||||
|
||||
2. **Unused Local Variables**: `ViewerShellViewModel.Initialize()` methods set local `int i` variables that are never used—likely debug stubs.
|
||||
|
||||
3. **Duplicate DataContext Assignment**: `ExportMainViewModel` constructor sets `View.DataContext = this` twice
|
||||
63
enriched-partialglm/DTS Viewer/DTS.Viewer/Properties.md
Normal file
63
enriched-partialglm/DTS Viewer/DTS.Viewer/Properties.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/Properties/Settings.Designer.cs
|
||||
- DTS Viewer/DTS.Viewer/Properties/AssemblyInfo.cs
|
||||
- DTS Viewer/DTS.Viewer/Properties/Resources.Designer.cs
|
||||
generated_at: "2026-04-16T11:23:58.003501+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "06945b304ce6ac54"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.Properties
|
||||
|
||||
## 1. Purpose
|
||||
This module provides the auto-generated infrastructure for application settings, localized resource management, and assembly metadata for the **DTS.Viewer** application. It acts as the configuration and identity layer, enabling strongly-typed access to user preferences via the `Settings` class and culture-specific resource lookups via the `Resources` class. The `AssemblyInfo.cs` file defines the application's version, company attribution (Diversified Technical Systems, Inc.), and WPF theme resource locations.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `DTS.Viewer.Properties.Settings`
|
||||
* **Signature**: `internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase`
|
||||
* **Properties**:
|
||||
* `public static Settings Default { get; }`: Returns the singleton instance of the application settings wrapper. This is the primary entry point for accessing application settings.
|
||||
* **Behavior**: Provides a thread-safe singleton wrapper for application configuration. Note that the provided source contains no custom setting properties; they must be defined in the associated `.settings` file and regenerated into this partial class.
|
||||
|
||||
### Class: `DTS.Viewer.Properties.Resources`
|
||||
* **Signature**: `internal class Resources`
|
||||
* **Properties**:
|
||||
* `internal static global::System.Resources.ResourceManager ResourceManager { get; }`: Returns the cached `ResourceManager` instance responsible for looking up localized resources (strings, images, etc.) within the "DTS.Viewer.Properties.Resources" scope.
|
||||
* `internal static global::System.Globalization.CultureInfo Culture { get; set; }`: Gets or sets the current `CultureInfo` used for resource lookups. Overrides the thread's current UI culture for this resource manager.
|
||||
* **Behavior**: Acts as a strongly-typed proxy for `.resx` files. Like the `Settings` class, the provided source shows only the infrastructure; specific resource properties (e.g., string constants) are auto-generated into this class based on the `.resx` content.
|
||||
|
||||
### Assembly Attributes (AssemblyInfo.cs)
|
||||
* **Identity**:
|
||||
* `[assembly: AssemblyTitle("DTS.Viewer")]`
|
||||
* `[assembly: AssemblyCompany("Diversified Technical Systems, Inc. (DTS)")]`
|
||||
* **Versioning**:
|
||||
* `[assembly: AssemblyVersion("1.0.0.0")]`
|
||||
* `[assembly: AssemblyFileVersion("1.0.0.0")]`
|
||||
* **COM Visibility**: `[assembly: ComVisible(false)]` — Types are not visible to COM components.
|
||||
* **Theming**: `[assembly: ThemeInfo(...)]` — Configures WPF to look for generic resource dictionaries in the source assembly.
|
||||
|
||||
## 3. Invariants
|
||||
* **Singleton Guarantee**: The `Settings.Default` property is guaranteed to return a synchronized, thread-safe instance of the `Settings` class (enforced by `ApplicationSettingsBase.Synchronized`).
|
||||
* **Lazy Initialization**: The `Resources.ResourceManager` property is lazily initialized; the internal `resourceMan` field remains `null` until the property is first accessed.
|
||||
* **Code Generation**: Both `Settings` and `Resources` are marked with `GeneratedCodeAttribute`. Manual edits to these files will be overwritten by the tooling (Visual Studio Settings Designer or ResGen) during the next regeneration.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies of this Module
|
||||
* **System.Configuration**: Required for `ApplicationSettingsBase` (used by `Settings`).
|
||||
* **System.Resources**: Required for `ResourceManager` (used by `Resources`).
|
||||
* **System.Globalization**: Required for `CultureInfo` (used by `Resources`).
|
||||
* **System.Windows**: Required for `ResourceDictionaryLocation` (used in `AssemblyInfo.cs` for WPF theming).
|
||||
* **System.Reflection**, **System.Runtime.InteropServices**: Required for assembly-level metadata attributes.
|
||||
|
||||
### Dependents of this Module
|
||||
* **DTS.Viewer Assembly**: All code within the `DTS.Viewer` project relies on `Properties.Settings.Default` for configuration persistence and `Properties.Resources` for localized strings and assets.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Auto-Generated Code Warning**: The source files `Settings.Designer.cs` and `Resources.Designer.cs` contain explicit warnings that manual changes will be lost. Developers must modify the underlying XML files (`.settings` and `.resx`) rather than the C# source.
|
||||
* **Missing Custom Properties**: The provided source for `Settings` and `Resources` contains only the infrastructure code (singleton pattern and resource manager plumbing). No actual user settings or resource strings are visible in the provided text; this implies the specific data values are defined elsewhere (in XML) and injected during the build process.
|
||||
* **Template Copyright**: The `AssemblyInfo.cs` file contains `AssemblyCopyright("Copyright © Microsoft 2016")`. This appears to be a default Visual Studio template value that was not updated to reflect the actual company ("Diversified Technical Systems, Inc. (DTS)").
|
||||
* **Internal Visibility**: Both `Settings` and `Resources` are marked `internal`, meaning they are not accessible outside the `DTS.Viewer` assembly.
|
||||
67
enriched-partialglm/DTS Viewer/DTS.Viewer/RegionAdapters.md
Normal file
67
enriched-partialglm/DTS Viewer/DTS.Viewer/RegionAdapters.md
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/RegionAdapters/StackPanelRegionAdapter.cs
|
||||
generated_at: "2026-04-16T11:23:32.925488+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d99a52248dae627a"
|
||||
---
|
||||
|
||||
# StackPanelRegionAdapter Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`StackPanelRegionAdapter` is a Prism region adapter that enables a WPF `StackPanel` control to act as a Prism region. It bridges the Prism region infrastructure with the `StackPanel`'s `Children` collection, automatically synchronizing views added to or removed from the region with the panel's visual children. This allows views to be dynamically composed within a `StackPanel` using Prism's region management system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `StackPanelRegionAdapter` (Class)
|
||||
|
||||
**Inherits from:** `RegionAdapterBase<StackPanel>`
|
||||
|
||||
#### Constructor
|
||||
|
||||
```csharp
|
||||
public StackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
|
||||
```
|
||||
Initializes a new instance of the adapter, passing the region behavior factory to the base class.
|
||||
|
||||
#### Protected Methods
|
||||
|
||||
```csharp
|
||||
protected override void Adapt(IRegion region, StackPanel regionTarget)
|
||||
```
|
||||
Subscribes to the `region.Views.CollectionChanged` event and synchronizes the `StackPanel`'s `Children` collection:
|
||||
- On `NotifyCollectionChangedAction.Add`: Iterates `e.NewItems` and adds each `UIElement` to `regionTarget.Children`.
|
||||
- On `NotifyCollectionChangedAction.Remove`: Iterates `e.OldItems` and removes each `UIElement` from `regionTarget.Children` if present.
|
||||
- Returns immediately if `region` is `null`.
|
||||
|
||||
```csharp
|
||||
protected override IRegion CreateRegion()
|
||||
```
|
||||
Creates and returns a new `AllActiveRegion` instance, indicating all views in this region are considered active simultaneously.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The `region` parameter in `Adapt()` must not be `null` for any synchronization to occur (method returns early otherwise).
|
||||
- All items in `region.Views` must be castable to `UIElement`; the code performs a direct cast without type checking.
|
||||
- The `regionTarget` must be a valid `StackPanel` instance.
|
||||
- The adapter creates an `AllActiveRegion`, meaning all views added to this region will be active at once (as opposed to single-active regions like tabs).
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System.Collections.Specialized` (`NotifyCollectionChangedAction`)
|
||||
- `System.Windows` (`UIElement`)
|
||||
- `System.Windows.Controls` (`StackPanel`)
|
||||
- `Microsoft.Practices.Prism.Regions` (`IRegion`, `IRegionBehaviorFactory`, `RegionAdapterBase<T>`, `AllActiveRegion`)
|
||||
|
||||
### Consumers:
|
||||
- This adapter must be registered with the Prism region adapter mappings (not shown in source) to be used for `StackPanel` controls.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Unhandled collection actions**: The `Adapt` method only handles `Add` and `Remove` actions. `Replace`, `Move`, and `Reset` actions from `NotifyCollectionChangedAction` are silently ignored, which could lead to desynchronization if the region's view collection triggers these actions.
|
||||
- **No event unsubscription**: The `CollectionChanged` handler is never unsubscribed. If the adapter or region outlives the `StackPanel`, this could cause memory leaks or unexpected behavior.
|
||||
- **Redundant variable assignment**: In the `Remove` case, `var element = elementLoopVariable;` creates an unnecessary local copy. This appears to be a legacy closure pattern but serves no purpose here since the variable is not captured.
|
||||
- **No type safety on collection items**: The code casts `e.NewItems` and `e.OldItems` elements directly to `UIElement` without validation. Non-`UIElement` items will throw `InvalidCastException` at runtime.
|
||||
107
enriched-partialglm/DTS Viewer/DTS.Viewer/Resources.md
Normal file
107
enriched-partialglm/DTS Viewer/DTS.Viewer/Resources.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/Resources/TranslateExtension.cs
|
||||
- DTS Viewer/DTS.Viewer/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T11:23:12.329617+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "dbbc3094853fd65f"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.Resources Localization Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides localization/internationalization support for the DTS Viewer WPF application. It enables XAML-based string lookup through a markup extension pattern, allowing UI elements to bind to localized resources declaratively. The `TranslateExtension` class serves as a bridge between XAML markup and the underlying `StringResources` resource manager, while `StringResources` provides strongly-typed, auto-generated access to localized strings stored in compiled resource files (.resx).
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TranslateExtension` (Class)
|
||||
**Namespace:** `DTS.Viewer`
|
||||
**Attributes:** `[MarkupExtensionReturnType(typeof(string))]`
|
||||
|
||||
A WPF markup extension that resolves localization keys to their corresponding string values at runtime.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. Stores the key in a readonly field `_key`. |
|
||||
| `ProvideValue` | `public override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for the provided key. Returns `NotFound` constant if key is null/empty, or `NotFound + " " + _key` if the key is not found in resources. |
|
||||
| `NotFound` | `private const string NotFound = "#stringnotfound#"` | Fallback string returned when a key is invalid or missing. |
|
||||
|
||||
---
|
||||
|
||||
### `StringResources` (Class)
|
||||
**Namespace:** `DTS.Viewer.Resources`
|
||||
**Accessibility:** `internal`
|
||||
**Attributes:** `[GeneratedCode]`, `[DebuggerNonUserCode]`, `[CompilerGenerated]`
|
||||
|
||||
An auto-generated strongly-typed resource class providing access to localized strings.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Lazily-initialized, cached `ResourceManager` instance for the `DTS.Viewer.Resources.StringResources` resource bundle. |
|
||||
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the current UI culture for resource lookups. Overrides `Thread.CurrentUICulture` for this resource class. |
|
||||
|
||||
**Localized String Properties (all `internal static string`):**
|
||||
|
||||
| Property | Default Value (from comments) |
|
||||
|----------|-------------------------------|
|
||||
| `ChartOptionsHeader` | "Chart Options" |
|
||||
| `GraphsDefaultTitle` | "Graphs " |
|
||||
| `ModificationsHeader` | "Modify" |
|
||||
| `SavePDFError` | "Error occurred saving chart to PDF" |
|
||||
| `SavePDFSuccess` | "Chart saved succesfully as {0}{1} and {2}{3}" |
|
||||
| `SettingsTitle` | "Settings" |
|
||||
| `TestIDsDefaultTitle` | "Test IDs" |
|
||||
| `TestsDefaultTitle` | "Tests " |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Key immutability:** The `_key` field in `TranslateExtension` is `readonly` and set only at construction time.
|
||||
|
||||
2. **Null safety:** `ProvideValue` will never return null. It returns either the localized string, `NotFound` (for null/empty keys), or `NotFound + " " + _key` (for missing keys).
|
||||
|
||||
3. **ResourceManager singleton:** The `ResourceManager` property uses a check-then-create pattern with a temporary variable to ensure thread-safe lazy initialization.
|
||||
|
||||
4. **Resource name mapping:** The `ResourceManager` is initialized with the base name `"DTS.Viewer.Resources.StringResources"`, which must match the embedded resource path.
|
||||
|
||||
5. **Culture fallback:** If `Culture` property is not explicitly set (`resourceCulture` is null), `ResourceManager.GetString` uses the current thread's `CurrentUICulture`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` (core .NET types)
|
||||
- `System.Windows.Markup` - for `MarkupExtension` base class and `MarkupExtensionReturnTypeAttribute`
|
||||
- `System.Resources` - for `ResourceManager` class
|
||||
- `System.Globalization` - for `CultureInfo` class
|
||||
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices` - for auto-generated attributes
|
||||
- **Resource files (.resx)** - The actual localized string data backing `StringResources` (not included in source, but implied by the designer file)
|
||||
|
||||
### What depends on this module:
|
||||
- **XAML files in DTS.Viewer** - Use `{x:Static res:StringResources.PropertyName}` or `{local:Translate KeyName}` syntax for localized strings
|
||||
- **PDF export functionality** - Uses `SavePDFSuccess` and `SavePDFError` strings
|
||||
- **Chart/Graph UI components** - Use `ChartOptionsHeader`, `GraphsDefaultTitle`, `ModificationsHeader`
|
||||
- **Settings UI** - Uses `SettingsTitle`
|
||||
- **Test-related UI** - Uses `TestIDsDefaultTitle`, `TestsDefaultTitle`
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`StringResources` is `internal`:** The class cannot be accessed from outside the `DTS.Viewer` assembly. External libraries cannot directly use these resources.
|
||||
|
||||
2. **Missing key behavior:** Missing localization keys do not throw exceptions. Instead, they return `"#stringnotfound# {key}"`, which may appear in production UI if resources are misconfigured. This is intentional fallback behavior but could mask configuration errors.
|
||||
|
||||
3. **Typo in resource string:** The `SavePDFSuccess` resource contains "succesfully" (missing one 'l') per the source comments. This typo originates from the .resx file, not the generated code.
|
||||
|
||||
4. **Trailing spaces:** `GraphsDefaultTitle` and `TestsDefaultTitle` have trailing spaces in their default values ("Graphs " and "Tests "). This may be intentional for UI layout but could cause issues if trimmed unexpectedly.
|
||||
|
||||
5. **Format string dependency:** `SavePDFSuccess` expects 4 format arguments (`{0}{1} and {2}{3}`). Callers must provide exactly 4 arguments or a `FormatException` will occur at runtime.
|
||||
|
||||
6. **Auto-generated file warning:** `StringResources.Designer.cs` is regenerated by tooling. Manual edits will be lost. The underlying `.resx` file is the source of truth.
|
||||
82
enriched-partialglm/DTS Viewer/DTS.Viewer/View.md
Normal file
82
enriched-partialglm/DTS Viewer/DTS.Viewer/View.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/TabView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/View/MenuView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/View/MainView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/View/ShellView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/View/ViewerShellView.xaml.cs
|
||||
- DTS Viewer/DTS.Viewer/View/NavigationView.xaml.cs
|
||||
generated_at: "2026-04-16T11:23:56.516498+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c4a45b12e62dbb35"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer Views
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module contains the code-behind files for WPF views in the DTS Viewer application. It defines six view components (`TabView`, `MenuView`, `MainView`, `ShellView`, `ViewerShellView`, `NavigationView`) that serve as the visual layer of the application. Each view implements a corresponding interface from `DTS.Common.Interface`, enabling view abstraction—likely to support MVVM architecture, dependency injection, or unit testing. The views are thin wrappers around XAML definitions, with all interaction logic delegated to the XAML layer.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TabView`
|
||||
- **Namespace:** `DTS.Viewer`
|
||||
- **Implements:** `ITabView`
|
||||
- **Constructor:** `public TabView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
### `MenuView`
|
||||
- **Namespace:** `DTS.Viewer`
|
||||
- **Implements:** `IMenuView`
|
||||
- **Constructor:** `public MenuView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
### `MainView`
|
||||
- **Namespace:** `DTS.Viewer`
|
||||
- **Implements:** `IMainView`
|
||||
- **Constructor:** `public MainView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
### `ShellView`
|
||||
- **Namespace:** `DTS.Viewer.View`
|
||||
- **Implements:** `IViewerShellView`
|
||||
- **Constructor:** `public ShellView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
### `ViewerShellView`
|
||||
- **Namespace:** `DTS.Viewer`
|
||||
- **Implements:** `IViewerShellView`
|
||||
- **Constructor:** `public ViewerShellView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
### `NavigationView`
|
||||
- **Namespace:** `DTS.Viewer`
|
||||
- **Implements:** `INavigationView`
|
||||
- **Constructor:** `public NavigationView()` — Initializes the component via `InitializeComponent()`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- Each view class is declared `partial`, indicating the existence of a corresponding XAML file that completes the class definition at compile time.
|
||||
- Each view implements exactly one interface from `DTS.Common.Interface`.
|
||||
- The constructor for each view must call `InitializeComponent()` to load the associated XAML resources and UI definition.
|
||||
- `ShellView` and `ViewerShellView` both implement the same interface (`IViewerShellView`), but reside in different namespaces.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Interface` — Provides the interfaces (`ITabView`, `IMenuView`, `IMainView`, `IViewerShellView`, `INavigationView`) that each view implements.
|
||||
|
||||
### What depends on this module:
|
||||
- **Unclear from source alone.** Consumers would typically include view composition logic, MVVM view models, or dependency injection containers that resolve these view types. The associated XAML files (not provided) would also define the visual structure and bindings.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Duplicate interface implementation:** Both `ShellView` (in namespace `DTS.Viewer.View`) and `ViewerShellView` (in namespace `DTS.Viewer`) implement `IViewerShellView`. The reason for this duplication is unclear from source alone—it may indicate a refactoring in progress, a legacy artifact, or intentional separation for different contexts.
|
||||
|
||||
2. **Namespace inconsistency:** `ShellView` resides in `DTS.Viewer.View` while all other views reside directly in `DTS.Viewer`. This may cause confusion when resolving types or configuring dependency injection.
|
||||
|
||||
3. **No explicit behavior in code-behind:** All views contain only the constructor with `InitializeComponent()`. Any event handlers, commands, or UI logic must be defined in the XAML files (not provided) or handled via MVVM bindings.
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/DockPanelHorizontal/View/DockPanelHorizontalView.xaml.cs
|
||||
generated_at: "2026-04-16T11:24:16.471740+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5cdf7bb10effcdd4"
|
||||
---
|
||||
|
||||
# Documentation: DockPanelHorizontalView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`DockPanelHorizontalView` is a WPF view component representing a horizontal dock panel within the DTS Viewer application. It serves as the code-behind partial class for `DockPanelHorizontalView.xaml`, providing interaction logic for a horizontally-oriented docking layout element. This module exists to implement the `IDockPanelHorizontalView` interface, enabling it to be consumed by other components that depend on this abstraction.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DockPanelHorizontalView` (class)
|
||||
|
||||
**Namespace:** `DTS.Viewer`
|
||||
|
||||
**Implements:** `IDockPanelHorizontalView`
|
||||
|
||||
**Constructor:**
|
||||
|
||||
```csharp
|
||||
public DockPanelHorizontalView()
|
||||
```
|
||||
|
||||
Initializes a new instance of the `DockPanelHorizontalView` class and invokes `InitializeComponent()`, which loads and initializes the associated XAML-defined UI components.
|
||||
|
||||
**Note:** The base class is not explicitly declared in this file; it is defined in the corresponding XAML file (`DockPanelHorizontalView.xaml`) as is standard for WPF partial classes.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- `InitializeComponent()` must be called exactly once during construction, before the view instance is used. This is enforced by the constructor implementation.
|
||||
- The class must remain a `partial` class to allow the WPF compiler to merge the XAML-generated code with this code-behind.
|
||||
- The view must properly implement `IDockPanelHorizontalView`, though the specific interface members are not visible in this source file.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `DTS.Common.Base` — Imported but no direct usage is visible in this file; likely provides base types or utilities.
|
||||
- `DTS.Common.Interface` — Provides the `IDockPanelHorizontalView` interface that this class implements.
|
||||
|
||||
**What depends on this module:**
|
||||
- Cannot be determined from this source file alone. Consumers would be components that require an `IDockPanelHorizontalView` implementation, likely within the DTS Viewer application's docking infrastructure.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Base class is undefined in source:** The parent class of `DockPanelHorizontalView` is declared in the XAML file (typically `UserControl`, `Window`, or a custom base). The inheritance hierarchy cannot be confirmed from this file alone.
|
||||
- **Interface contract is opaque:** The members required by `IDockPanelHorizontalView` are not visible in this source. It is unclear whether the class should implement additional properties, methods, or events.
|
||||
- **Unused import:** The `DTS.Common.Base` namespace is imported but no types from it are directly referenced in the visible code. This may indicate historical refactoring or base class inheritance defined in XAML.
|
||||
@@ -0,0 +1,114 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/DockPanelHorizontal/ViewModel/DockPanelHorizontalViewModel.cs
|
||||
generated_at: "2026-04-16T11:24:34.196995+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6bc81faa835eebdc"
|
||||
---
|
||||
|
||||
# DockPanelHorizontalViewModel Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`DockPanelHorizontalViewModel` is a ViewModel component within a WPF/Prism-based application that manages the state and behavior of a horizontal dock panel UI element. It inherits from `BaseViewModel<IDockPanelHorizontalViewModel>` and implements `IDockPanelHorizontalViewModel`, serving as a coordinator between the view layer and the application's event system. The class provides notification/confirmation dialog support via Prism's `InteractionRequest` pattern and subscribes to application-wide `RaiseNotification` events.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
|
||||
```csharp
|
||||
public DockPanelHorizontalViewModel(
|
||||
IDockPanelHorizontalView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the View's `DataContext` to itself, creates `NotificationRequest` and `ConfirmationRequest` instances, stores dependencies, and subscribes to the `RaiseNotification` event via the `EventAggregator`.
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `View` | `IDockPanelHorizontalView` | `public get; private set` | Reference to the associated view instance. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | `public get; private set` | Prism interaction request for displaying notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | `public get; private set` | Prism interaction request for displaying confirmation dialogs. |
|
||||
| `IsMenuIncluded` | `bool` | `public get; set` | Flag indicating whether a menu is included. |
|
||||
| `IsNavigationIncluded` | `bool` | `public get; set` | Flag indicating whether navigation is included. |
|
||||
| `IsBusy` | `bool` | `public get; set` | Flag indicating busy/loading state. |
|
||||
| `IsDirty` | `bool` | `public get; private set` | Flag indicating unsaved changes state. |
|
||||
|
||||
### Events
|
||||
|
||||
```csharp
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
```
|
||||
Standard `INotifyPropertyChanged` event declaration.
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Return Type | Behavior |
|
||||
|--------|-------------|----------|
|
||||
| `Initialize()` | `void` | Throws `NotImplementedException`. |
|
||||
| `Initialize(object parameter)` | `void` | Throws `NotImplementedException`. |
|
||||
| `Activated()` | `void` | Throws `NotImplementedException`. |
|
||||
| `Cleanup()` | `void` | Throws `NotImplementedException`. |
|
||||
| `CleanupAsync()` | `Task` | Throws `NotImplementedException`. Marked with `new` keyword. |
|
||||
| `Initialize(object parameter, object model)` | `void` | Throws `NotImplementedException`. Marked with `new` keyword. |
|
||||
| `InitializeAsync()` | `Task` | Throws `NotImplementedException`. |
|
||||
| `InitializeAsync(object parameter)` | `Task` | Throws `NotImplementedException`. |
|
||||
|
||||
### Private Methods
|
||||
|
||||
```csharp
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
```
|
||||
Event handler for `RaiseNotification` events. Extracts `Message`, `MessageDetails`, `Image`, and `Title` from the received `NotificationContentEventArgs`, constructs a new `NotificationContentEventArgs` (without title), and raises the `NotificationRequest` with a `Notification` containing the reconstructed content and separate title.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The `View.DataContext` is set to `this` (the ViewModel instance) upon construction and is never changed.
|
||||
- `NotificationRequest` and `ConfirmationRequest` are always non-null after construction.
|
||||
- The `RaiseNotification` event subscription is established during construction and remains active for the lifetime of the ViewModel (no unsubscription is visible in the source).
|
||||
- `IsDirty` can only be modified internally (private setter).
|
||||
- The `_regionManager` field hides a base class member with the same name (via `new` keyword).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On
|
||||
|
||||
| Namespace | Type(s) Used |
|
||||
|-----------|--------------|
|
||||
| `DTS.Common.Base` | `BaseViewModel<T>` |
|
||||
| `DTS.Common.Events` | `RaiseNotification`, `NotificationContentEventArgs` |
|
||||
| `DTS.Common.Interface` | `IViewModel`, `IDockPanelHorizontalViewModel` |
|
||||
| `Microsoft.Practices.Prism.Events` | `IEventAggregator` |
|
||||
| `Microsoft.Practices.Prism.Interactivity.InteractionRequest` | `InteractionRequest<T>`, `Notification`, `Confirmation` |
|
||||
| `Microsoft.Practices.Prism.Regions` | `IRegionManager` |
|
||||
| `Microsoft.Practices.Unity` | `IUnityContainer` |
|
||||
|
||||
### What Depends On This Module
|
||||
|
||||
Not determinable from source alone. The module implements `IDockPanelHorizontalViewModel`, suggesting consumers depend on that interface rather than the concrete class directly.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Most lifecycle methods are unimplemented**: `Initialize()`, `Initialize(object)`, `Activated()`, `Cleanup()`, `CleanupAsync()`, `Initialize(object, object)`, `InitializeAsync()`, and `InitializeAsync(object)` all throw `NotImplementedException`. This class appears to be a partial implementation or stub.
|
||||
|
||||
2. **Method hiding with `new` keyword**: `CleanupAsync()` and `Initialize(object parameter, object model)` use `new` rather than `override`, potentially hiding base class implementations. This may indicate a design inconsistency or versioning artifact.
|
||||
|
||||
3. **Field hiding**: The `_regionManager` field is declared with `new`, hiding a base class member. The implications of this depend on the base class implementation.
|
||||
|
||||
4. **Redundant object construction in `OnRaiseNotification`**: The handler constructs a new `NotificationContentEventArgs` from the received one, passing `Message`, `MessageDetails`, and `Image` to the constructor. The comment indicates this is intentional ("expects a NotificationContentEventArgsWithoutTitle object"), but the type used is `NotificationContentEventArgs`. Whether this is correct or a bug is unclear from source alone.
|
||||
|
||||
5. **No event unsubscription**: There is no visible unsubscription from `RaiseNotification` in any cleanup method. Since `Cleanup()` throws `NotImplementedException`, memory leaks via event subscription are possible if the base class does not handle this.
|
||||
|
||||
6. **Unused `Parent` property**: The `Parent` property (type `IViewModel`) is declared but never assigned or used in the visible source.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/DockPanelVertical/View/DockPanelVerticalView.xaml.cs
|
||||
generated_at: "2026-04-16T11:25:25.151183+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "dd7d632d568da85b"
|
||||
---
|
||||
|
||||
# Documentation: DockPanelVerticalView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`DockPanelVerticalView` is a WPF view component that serves as the code-behind for a XAML-defined vertical dock panel user interface. It implements the `IDockPanelVerticalView` interface, enabling abstraction and likely facilitating dependency injection or MVVM pattern integration within the DTS Viewer application.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `DockPanelVerticalView`
|
||||
**Namespace:** `DTS.Viewer`
|
||||
**Implements:** `IDockPanelVerticalView`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public DockPanelVerticalView()` | Initializes a new instance of the view and calls `InitializeComponent()` to load the associated XAML layout. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- `InitializeComponent()` must be called exactly once during construction for the XAML-defined UI elements to be instantiated.
|
||||
- The class is `partial`, indicating it must be paired with a corresponding XAML file (`DockPanelVerticalView.xaml`) that defines the visual layout.
|
||||
- The view must implement `IDockPanelVerticalView` to satisfy the interface contract (specific interface members are not visible in this source file).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` — Imported but no types from this namespace are directly referenced in the visible source.
|
||||
- `DTS.Common.Interface` — Provides the `IDockPanelVerticalView` interface that this class implements.
|
||||
- **WPF infrastructure** — Implicit dependency on `System.Windows` (inferred from `InitializeComponent()` pattern and `.xaml.cs` file extension).
|
||||
|
||||
### What depends on this module:
|
||||
- **Not determinable from source alone.** Consumers would typically be parent views, view composition logic, or an IoC container registering this view.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Base class not visible:** The source does not explicitly declare a base class. As a `partial` class paired with XAML, the base class is likely defined in the XAML root element (commonly `UserControl` or `Window`). The exact base type cannot be confirmed from this file alone.
|
||||
- **Empty code-behind:** The class contains no additional logic beyond initialization. Any behavior (event handlers, data binding setup, etc.) is either in the XAML file, a associated ViewModel, or injected elsewhere.
|
||||
- **Unused import:** `DTS.Common.Base` is imported but no types from it are referenced in the visible code. This may indicate legacy code, a removed feature, or types used only in the XAML portion.
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/DockPanelVertical/ViewModel/DockPanelVerticalViewModel.cs
|
||||
generated_at: "2026-04-16T11:25:25.613899+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0185c1c3d29b204b"
|
||||
---
|
||||
|
||||
# DockPanelVerticalViewModel Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`DockPanelVerticalViewModel` is a ViewModel component for a vertical dock panel UI element within a WPF/Prism-based application. It serves as the data context for `IDockPanelVerticalView`, managing notification/confirmation dialogs and exposing panel configuration state flags. The class inherits from `BaseViewModel<IDockPanelVerticalViewModel>` and integrates with Prism's event aggregation and region management infrastructure.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
|
||||
```csharp
|
||||
public DockPanelVerticalViewModel(
|
||||
IDockPanelVerticalView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the View's DataContext to itself, creates interaction requests, and subscribes to the `RaiseNotification` event.
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `View` | `IDockPanelVerticalView` | `get` | Reference to the associated view instance. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | `get` | Prism interaction request for displaying notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | `get` | Prism interaction request for displaying confirmations. |
|
||||
| `IsMenuIncluded` | `bool` | `get/set` | Flag indicating whether a menu is included in the panel. |
|
||||
| `IsNavigationIncluded` | `bool` | `get/set` | Flag indicating whether navigation is included in the panel. |
|
||||
| `IsBusy` | `bool` | `get/set` | Busy state indicator. |
|
||||
| `IsDirty` | `bool` | `get` (private set) | Dirty state indicator; read-only externally. |
|
||||
|
||||
### Events
|
||||
|
||||
```csharp
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
```
|
||||
Declared but **never invoked** within this class.
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Return Type | Behavior |
|
||||
|--------|-------------|----------|
|
||||
| `Initialize()` | `void` | Throws `NotImplementedException`. |
|
||||
| `Initialize(object parameter)` | `void` | Throws `NotImplementedException`. |
|
||||
| `Initialize(object parameter, object model)` | `void` | Throws `NotImplementedException`. Uses `new` keyword. |
|
||||
| `InitializeAsync()` | `Task` | Throws `NotImplementedException`. |
|
||||
| `InitializeAsync(object parameter)` | `Task` | Throws `NotImplementedException`. |
|
||||
| `Activated()` | `void` | Throws `NotImplementedException`. |
|
||||
| `Cleanup()` | `void` | Throws `NotImplementedException`. |
|
||||
| `CleanupAsync()` | `Task` | Throws `NotImplementedException`. Uses `new` keyword. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **DataContext Binding**: The View's `DataContext` is always set to `this` ViewModel instance upon construction.
|
||||
- **Event Subscription**: The ViewModel subscribes to `RaiseNotification` event during construction; the subscription lifetime is tied to the EventAggregator's scope.
|
||||
- **Notification Transformation**: `OnRaiseNotification` transforms `NotificationContentEventArgs` (with title) into `NotificationContentEventArgs` (without title) plus a separate Title string when raising the notification request.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` — `BaseViewModel<T>`
|
||||
- `DTS.Common.Events` — `RaiseNotification` event, `NotificationContentEventArgs`
|
||||
- `DTS.Common.Interface` — `IViewModel`, `IDockPanelVerticalViewModel`, `IDockPanelVerticalView`
|
||||
- `Microsoft.Practices.Prism.Events` — `IEventAggregator`
|
||||
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` — `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- `Microsoft.Practices.Prism.Regions` — `IRegionManager`
|
||||
- `Microsoft.Practices.Unity` — `IUnityContainer`
|
||||
|
||||
### What depends on this module:
|
||||
- **Unclear from source alone** — No consumers are visible in this file. Likely consumed by View implementations and/or DI container registrations.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Incomplete Implementation**: All lifecycle methods (`Initialize`, `InitializeAsync`, `Activated`, `Cleanup`, `CleanupAsync`) throw `NotImplementedException`. This class appears to be a stub or work-in-progress.
|
||||
|
||||
2. **Member Hiding**:
|
||||
- The `_regionManager` field uses `new`, hiding a base class member of the same name.
|
||||
- `CleanupAsync()` and `Initialize(object parameter, object model)` also use `new`, hiding base implementations rather than overriding them.
|
||||
|
||||
3. **Unused `PropertyChanged` Event**: The event is declared but never raised. If property change notification is expected by consumers, it will not function.
|
||||
|
||||
4. **Unused `ConfirmationRequest`**: The `ConfirmationRequest` property is instantiated but never raised anywhere in this class.
|
||||
|
||||
5. **Unused State Properties**: `IsMenuIncluded`, `IsNavigationIncluded`, `IsBusy`, and `IsDirty` are declared but never read or written within this class (other than being auto-initialized).
|
||||
|
||||
6. **Potential Memory Leak**: The `RaiseNotification` event subscription does not appear to be unsubscribed in cleanup (though cleanup throws anyway). If the EventAggregator uses weak references, this may be safe; otherwise, it could cause memory retention issues.
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/Navigation/View/NavigationView.xaml.cs
|
||||
generated_at: "2026-04-16T11:25:05.068358+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4b4942c6e8f5eadd"
|
||||
---
|
||||
|
||||
# Documentation: NavigationView
|
||||
|
||||
## 1. Purpose
|
||||
This module defines the code-behind class for the `NavigationView` component within the DTS Viewer application. It serves as a WPF User Control responsible for the visual presentation of navigation elements. Its primary role is to implement the `INavigationView` interface, bridging the gap between the XAML layout definition and the application's navigation logic.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `NavigationView`
|
||||
**Inherits:** `INavigationView` (from `DTS.Common.Interface`)
|
||||
**Type:** `partial` class
|
||||
|
||||
#### Constructor: `NavigationView()`
|
||||
* **Signature:** `public NavigationView()`
|
||||
* **Behavior:** Initializes the component. It calls the standard WPF `InitializeComponent()` method, which loads the associated XAML markup (`NavigationView.xaml`) required to render the view.
|
||||
|
||||
## 3. Invariants
|
||||
* **WPF Initialization:** The `InitializeComponent()` method must be called exactly once upon instantiation to ensure the UI elements defined in XAML are created.
|
||||
* **Interface Compliance:** As this class implements `INavigationView`, it must satisfy the contract defined in `DTS.Common.Interface.INavigationView`. (Note: The specific members of this interface are not visible in the provided source).
|
||||
|
||||
## 4. Dependencies
|
||||
* **Imports:**
|
||||
* `DTS.Common.Interface`: Used for the `INavigationView` interface.
|
||||
* **Internal Dependencies:**
|
||||
* `NavigationView.xaml`: This is a code-beind file; it relies on a corresponding XAML file to define the actual UI structure.
|
||||
* Implicit WPF Assemblies: Relies on `System.Windows` (specifically `System.Windows.Controls.UserControl` behavior) for `InitializeComponent()`.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Missing Logic Implementation:** The source file contains no explicit implementation of the `INavigationView` interface members. It is unclear from this source alone whether the interface is a marker interface (empty) or if the implementation is expected elsewhere (e.g., via explicit interface implementation not shown, or if the file provided is incomplete).
|
||||
* **XAML Dependency:** The functionality and visual behavior of this view are entirely dependent on the associated `NavigationView.xaml` file, which is not included here. The C# code acts purely as a bridge.
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/View/Navigation/ViewModel/NavigationViewModel.cs
|
||||
generated_at: "2026-04-16T11:24:52.139730+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a00beb6f74b53389"
|
||||
---
|
||||
|
||||
# Documentation: NavigationViewModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`NavigationViewModel` is a Prism-based ViewModel responsible for managing the navigation region within the DTS Viewer application's shell. It serves as a mediator between the `INavigationView` and the application's navigation infrastructure, handling notification events via `IEventAggregator` and exposing a `ContextNavigationRegion` property for dynamically setting navigation content. This class inherits from `BaseViewModel<INavigationViewModel>` and implements the `INavigationViewModel` interface.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
|
||||
```csharp
|
||||
public NavigationViewModel(INavigationView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the view model with its associated view and Prism infrastructure dependencies. Sets the view's `DataContext` to itself, initializes interaction requests, and subscribes to the `RaiseNotification` event.
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `NavigationView` | `INavigationView` | `get; private set;` | The associated navigation view instance. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | `get; private set;` | Interaction request for displaying notifications. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | `get; private set;` | Interaction request for displaying confirmations. |
|
||||
| `ContextNavigationRegion` | `object` | `get; set;` | Gets or sets the content of the `NavigationRegion` on the underlying view. Raises `OnPropertyChanged` on set. |
|
||||
| `HeaderInfo` | `string` | `get;` | Returns the constant string `"NavigationRegion"`. |
|
||||
| `IsBusy` | `bool` | `get; set;` | **Throws `NotImplementedException`** in both getter and setter. |
|
||||
| `IsDirty` | `bool` | `get;` | **Throws `NotImplementedException`** in getter. |
|
||||
|
||||
### Events
|
||||
|
||||
```csharp
|
||||
public new event PropertyChangedEventHandler PropertyChanged;
|
||||
```
|
||||
Hides the base class event. Raised via the private `OnPropertyChanged(string propertyName)` method.
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Return Type | Description |
|
||||
|--------|-------------|-------------|
|
||||
| `Initialize()` | `void` | Empty override; performs no initialization. |
|
||||
| `Initialize(object parameter)` | `void` | Sets the `Parent` property by casting `parameter` to `IShellViewModel`. |
|
||||
| `Activated()` | `void` | **Throws `NotImplementedException`**. |
|
||||
| `Cleanup()` | `void` | **Throws `NotImplementedException`**. |
|
||||
| `CleanupAsync()` | `Task` | **Throws `NotImplementedException`**. |
|
||||
| `InitializeAsync()` | `Task` | **Throws `NotImplementedException`**. |
|
||||
| `InitializeAsync(object parameter)` | `Task` | **Throws `NotImplementedException`**. |
|
||||
|
||||
### Private Methods
|
||||
|
||||
```csharp
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
```
|
||||
Event handler for `RaiseNotification` events. Transforms `NotificationContentEventArgs` into a `NotificationContentEventArgs` (without title) and raises the `NotificationRequest` with separate content and title.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- `NavigationView` is assigned in the constructor and never reassigned.
|
||||
- `Parent` is only set via `Initialize(object parameter)` and must be castable to `IShellViewModel`.
|
||||
- The `RaiseNotification` event subscription is established at construction time and remains active for the lifetime of the view model.
|
||||
- `ContextNavigationRegion` assumes the underlying `NavigationView` can be cast to the concrete `NavigationView` type to access `NavigationRegion.Content`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` — Provides `BaseViewModel<T>`
|
||||
- `DTS.Common.Events` — Provides `RaiseNotification` event and `NotificationContentEventArgs`
|
||||
- `DTS.Common.Interface` — Provides `INavigationViewModel`, `INavigationView`, `IShellViewModel`
|
||||
- `Microsoft.Practices.Prism.Events` — Provides `IEventAggregator`
|
||||
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` — Provides `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- `Microsoft.Practices.Prism.Regions` — Provides `IRegionManager`
|
||||
- `Microsoft.Practices.Unity` — Provides `IUnityContainer`
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone (no consumers visible in this file).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Incomplete Implementation**: Multiple methods (`Activated`, `Cleanup`, `CleanupAsync`, `InitializeAsync`, `InitializeAsync(object parameter)`) and properties (`IsBusy`, `IsDirty`) throw `NotImplementedException`. This class appears to be partially implemented.
|
||||
|
||||
2. **Member Hiding**: The `new` keyword is used to hide base class members (`PropertyChanged`, `OnPropertyChanged`, `IsBusy`, `IsDirty`, `CleanupAsync`). This may indicate a design issue or conflict with the base `BaseViewModel<T>` implementation.
|
||||
|
||||
3. **Stale XML Documentation**: The constructor's XML comment states "Creates a new instance of the TechnologyDoFrontEditViewModel" — this appears to be a copy-paste error from another view model.
|
||||
|
||||
4. **Unsafe Cast in ContextNavigationRegion**: The property directly casts `INavigationView` to the concrete `NavigationView` type:
|
||||
```csharp
|
||||
((NavigationView)NavigationView).NavigationRegion.Content
|
||||
```
|
||||
This will throw an `InvalidCastException` at runtime if the injected view is not exactly of type `NavigationView`.
|
||||
|
||||
5. **Event Transformation Logic**: `OnRaiseNotification` creates a new `NotificationContentEventArgs` from the received event args, extracting `Message`, `MessageDetails`, and `Image` while separating `Title`. This transformation may lose data if additional properties exist on the source event args.
|
||||
221
enriched-partialglm/DTS Viewer/DTS.Viewer/ViewModel.md
Normal file
221
enriched-partialglm/DTS Viewer/DTS.Viewer/ViewModel.md
Normal file
@@ -0,0 +1,221 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer/ViewModel/NavigationViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/ViewModel/MenuViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/ViewModel/ShellViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/ViewModel/ViewerShellViewModel.cs
|
||||
- DTS Viewer/DTS.Viewer/ViewModel/MainViewModel.cs
|
||||
generated_at: "2026-04-16T11:23:08.528119+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7a17d7bd36c83744"
|
||||
---
|
||||
|
||||
# DTS.Viewer ViewModel Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module contains the core ViewModel layer for the DTS Viewer WPF application, implementing the MVVM pattern using Microsoft Prism and Unity. It provides the orchestration layer between the Views and the business logic, managing navigation regions, user notifications, and shell composition. The ViewModels handle view lifecycle (initialization, activation, cleanup), region management for dynamic view injection, and event-driven communication via `IEventAggregator`. This module serves as the structural backbone for the application's UI composition system.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### NavigationViewModel
|
||||
**Inherits:** `BaseViewModel<INavigationViewModel>`
|
||||
**Implements:** `INavigationViewModel`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `NavigationViewModel(INavigationView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Initializes the view model, sets DataContext, creates interaction requests, and subscribes to `RaiseNotification` event. |
|
||||
| NavigationView | `INavigationView { get; private set; }` | Holds reference to the associated view. |
|
||||
| ContextNavigationRegion | `object { get; set; }` | Gets/sets the content of the `NavigationRegion` on the view. Raises `OnPropertyChanged("ContextNavigationRegion")` on set. |
|
||||
| HeaderInfo | `string { get; }` | Returns hardcoded string `"NavigationRegion"`. |
|
||||
| Initialize | `override void Initialize()` | Empty implementation. |
|
||||
| Initialize | `override void Initialize(object parameter)` | Casts parameter to `IShellViewModel` and assigns to `Parent`. |
|
||||
| OnRaiseNotification | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Handles `RaiseNotification` events, transforms args and raises `NotificationRequest`. |
|
||||
| IsBusy | `bool { get; set; }` | Throws `NotImplementedException`. |
|
||||
| IsDirty | `bool { get; }` | Throws `NotImplementedException`. |
|
||||
| Activated | `override void Activated()` | Throws `NotImplementedException`. |
|
||||
| Cleanup | `override void Cleanup()` | Throws `NotImplementedException`. |
|
||||
| CleanupAsync | `Task CleanupAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `override Task InitializeAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `override Task InitializeAsync(object parameter)` | Throws `NotImplementedException`. |
|
||||
|
||||
---
|
||||
|
||||
### MenuViewModel
|
||||
**Inherits:** `BaseViewModel<IMenuViewModel>`
|
||||
**Implements:** `IMenuViewModel`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `MenuViewModel(IMenuView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Initializes the view model, sets DataContext, creates interaction requests, and subscribes to `RaiseNotification` event. |
|
||||
| View | `IMenuView { get; private set; }` | Holds reference to the associated view. |
|
||||
| HeaderInfo | `string { get; }` | Returns hardcoded string `"MainRegion"`. |
|
||||
| Initialize | `override void Initialize()` | Contains placeholder code (`int i = 10;`). |
|
||||
| Initialize | `override void Initialize(object parameter)` | Casts parameter to `IShellViewModel` and assigns to `Parent`. |
|
||||
| CreateViews | `void CreateViews(Boolean initialize)` | Creates a `ViewDefinition` for `RegionNames.MainRegion` with `IBaseView`/`IBaseViewModel` types. Currently the `_regionManager.AddView` call is commented out. |
|
||||
| OnRaiseNotification | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Handles `RaiseNotification` events. |
|
||||
| IsBusy | `bool { get; set; }` | Throws `NotImplementedException`. |
|
||||
| IsDirty | `bool { get; }` | Throws `NotImplementedException`. |
|
||||
| Activated | `override void Activated()` | Throws `NotImplementedException`. |
|
||||
| Cleanup | `override void Cleanup()` | Throws `NotImplementedException`. |
|
||||
| CleanupAsync | `Task CleanupAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `override Task InitializeAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `override Task InitializeAsync(object parameter)` | Throws `NotImplementedException`. |
|
||||
|
||||
---
|
||||
|
||||
### ShellViewModel
|
||||
**Inherits:** `NotificationObject`
|
||||
**Implements:** `IViewerShellViewModel`
|
||||
**Attributes:** `[Export(typeof(IShellView))]`, `[PartCreationPolicy(CreationPolicy.Shared)]`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `ShellViewModel(IViewerShellView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Initializes view, subscribes to `RaiseNotification`, registers `IMainView`→`MainView` and `IMainViewModel`→`MainViewModel` (singleton) with Unity. |
|
||||
| View | `IViewerShellView { get; private set; }` | Holds reference to the shell view. |
|
||||
| ContextMainRegion | `Object { get; set; }` | Gets/sets content of `MainRegion` from `ShellView`. Raises `OnPropertyChanged("ContextMainRegion")` on set. |
|
||||
| IsMenuIncluded | `bool { get; set; }` | Controls menu visibility. Raises `OnPropertyChanged` on set. |
|
||||
| IsNavigationIncluded | `bool { get; set; }` | Controls navigation visibility. Raises `OnPropertyChanged` on set. |
|
||||
| HeaderInfo | `string { get; }` | Returns hardcoded string `"MainRegion"`. |
|
||||
| GetRegions | `List<FrameworkElement> GetRegions()` | Uses `Utils.GetChildrenByName` to find elements named `"Region"` in `MainShell`. |
|
||||
| Initialize | `void Initialize()` | Placeholder implementation (`int i = 10;`). |
|
||||
| Initialize | `void Initialize(object parameter)` | Placeholder implementation (`int i = 22;`). |
|
||||
| Initialize | `void Initialize(object parameter, object model)` | Empty implementation. |
|
||||
| Activated | `void Activated()` | Placeholder (`var s = String.Empty;`). |
|
||||
| OnRaiseNotification | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Handles `RaiseNotification` events. |
|
||||
| IsBusy | `bool { get; }` | Throws `NotImplementedException`. |
|
||||
| IsDirty | `bool { get; }` | Throws `NotImplementedException`. |
|
||||
| Cleanup | `void Cleanup()` | Throws `NotImplementedException`. |
|
||||
| CleanupAsync | `Task CleanupAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `Task InitializeAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `Task InitializeAsync(object parameter)` | Throws `NotImplementedException`. |
|
||||
|
||||
---
|
||||
|
||||
### ViewerShellViewModel
|
||||
**Inherits:** `NotificationObject`
|
||||
**Implements:** `IViewerShellViewModel`
|
||||
**Attributes:** `[Export(typeof(IShellView))]`, `[PartCreationPolicy(CreationPolicy.Shared)]`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `ViewerShellViewModel(IViewerShellView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Initializes view, subscribes to `RaiseNotification`, registers `IViewerMainView`→`ViewerMainView` and `IViewerMainViewModel`→`ViewerMainViewModel` (singleton) with Unity. |
|
||||
| View | `IViewerShellView { get; private set; }` | Holds reference to the shell view. |
|
||||
| ContextMainRegion | `Object { get; set; }` | Gets/sets content of `MainRegion` from `ViewerShellView`. |
|
||||
| IsMenuIncluded | `bool { get; set; }` | Controls menu visibility. |
|
||||
| IsNavigationIncluded | `bool { get; set; }` | Controls navigation visibility. |
|
||||
| IsBusy | `bool { get; set; }` | **Implemented** - unlike other ViewModels, this has a backing field `_isBusy` and raises property changed. |
|
||||
| HeaderInfo | `string { get; }` | Returns hardcoded string `"MainRegion"`. |
|
||||
| GetRegions | `List<FrameworkElement> GetRegions()` | Uses `Utils.GetChildrenByName` on `ViewerShellView.MainShell`. |
|
||||
| Initialize | `void Initialize()` | Placeholder (`int i = 10;`). |
|
||||
| Initialize | `void Initialize(object parameter)` | Placeholder (`int i = 22;`). |
|
||||
| Initialize | `void Initialize(object parameter, object model)` | Empty implementation. |
|
||||
| Activated | `void Activated()` | Placeholder (`var s = String.Empty;`). |
|
||||
| OnRaiseNotification | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Handles `RaiseNotification` events. |
|
||||
| IsDirty | `bool { get; }` | Throws `NotImplementedException`. |
|
||||
| Cleanup | `void Cleanup()` | Throws `NotImplementedException`. |
|
||||
| CleanupAsync | `Task CleanupAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `Task InitializeAsync()` | Throws `NotImplementedException`. |
|
||||
| InitializeAsync | `Task InitializeAsync(object parameter)` | Throws `NotImplementedException`. |
|
||||
| OnPropertyChanged | `void IBasePropertyChanged.OnPropertyChanged(string propertyName)` | Throws `NotImplementedException`. |
|
||||
|
||||
---
|
||||
|
||||
### MainViewModel
|
||||
**Inherits:** `BaseViewModel<IMainViewModel>`
|
||||
**Implements:** `IMainViewModel`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `MainViewModel(IMainView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Initializes view, subscribes to `RaiseNotification` and `AssemblyListNotification` events, registers `IMenuView`/`IMenuViewModel` and `INavigationView`/`INavigationViewModel` with Unity. |
|
||||
| View | `IMainView { get; private set; }` | Holds reference to the main view. |
|
||||
| ContextMainRegion | `object { get; set; }` | Currently returns `null` on get; setter raises `OnPropertyChanged("ContextMainRegion")` but content assignment is commented out. |
|
||||
| IsMenuIncluded | `bool { get; set; }` | Backed by `_isMenuIncluded` field. |
|
||||
| IsNavigationIncluded | `bool { get; set; }` | Backed by `_isNavigationIncluded` field. |
|
||||
| HeaderInfo | `string { get; }` | Returns hardcoded string `"MainRegion"`. |
|
||||
| Initialize | `override void Initialize()` | Empty implementation. |
|
||||
| Initialize | `override void Initialize(object parameter)` | Casts to `IViewerShellViewModel`, sets `Parent.IsMenuIncluded` and `Parent.IsNavigationIncluded`, subscribes to `AssemblyListNotification` event with `ThreadOption.PublisherThread`. |
|
||||
| Activated | `override void Activated()` | Empty implementation. |
|
||||
| OnAssemblyListChange | `void OnAssemblyListChange(AssemblyListInfo e)` | Handler for `AssemblyListNotification` event. **Entire implementation is commented out.** |
|
||||
| OnRaiseNotification | `void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)` | Handles `RaiseNotification` events. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Constructor Pattern**: All ViewModels must receive exactly four constructor parameters: the view interface, `IRegionManager`, `IEventAggregator`, and `IUnityContainer`. The view's `DataContext` is set to `this` within the constructor.
|
||||
|
||||
2. **Event Subscription**: All ViewModels subscribe to `RaiseNotification` event via `EventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification)` during construction.
|
||||
|
||||
3. **Notification Transformation**: The `OnRaiseNotification` handler always transforms `NotificationContentEventArgs` to a new instance with `(Message, MessageDetails, Image)` before raising the `NotificationRequest`.
|
||||
|
||||
4. **Parent Assignment**: The `Initialize(object parameter)` method expects `parameter` to be castable to either `IShellViewModel` (for `NavigationViewModel`, `MenuViewModel`) or `IViewerShellViewModel` (for `MainViewModel`).
|
||||
|
||||
5. **Region Naming Convention**: Region content properties follow the naming pattern `Context{RegionName}Region` (e.g., `ContextMainRegion`, `ContextNavigationRegion`).
|
||||
|
||||
6. **HeaderInfo Consistency**: All ViewModels return a hardcoded region name string from `HeaderInfo`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (Imports)
|
||||
- `Microsoft.Practices.Prism.Events` - `IEventAggregator`, event publishing/subscription
|
||||
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` - `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- `Microsoft.Practices.Prism.Regions` - `IRegionManager`
|
||||
- `Microsoft.Practices.Prism.ViewModel` - `NotificationObject`
|
||||
- `Microsoft.Practices.Unity` - `IUnityContainer`, `ContainerControlledLifetimeManager`
|
||||
- `System.ComponentModel.Composition` - MEF attributes (`Export`, `PartCreationPolicy`, `CreationPolicy`)
|
||||
- `System.Windows` - `FrameworkElement` (used in `GetRegions()`)
|
||||
|
||||
### Internal Dependencies (DTS.*)
|
||||
- `DTS.Common.Base` - `BaseViewModel<T>`, `ViewDefinition`
|
||||
- `DTS.Common.Events` - `RaiseNotification`, `NotificationContentEventArgs`, `AssemblyListNotification`, `AssemblyListInfo`
|
||||
- `DTS.Common.Interface` - `INavigationViewModel`, `IMenuViewModel`, `IShellViewModel`, `IViewerShellViewModel`, `IMainViewModel`, `IBaseViewModel`, `IBaseView`, `IBasePropertyChanged`
|
||||
- `DTS.Common.Utils` - `Utils.GetChildrenByName`
|
||||
- `DTS.Common.Classes` - Referenced in `MenuViewModel`
|
||||
- `DTS.Viewer.View` - `ShellView`, `ViewerShellView`, `MainView`, `MenuView`, `NavigationView`, `ViewerMainView`
|
||||
|
||||
### Dependency Graph
|
||||
```
|
||||
ShellViewModel / ViewerShellViewModel (root)
|
||||
└── registers MainViewModel / ViewerMainViewModel
|
||||
└── MainViewModel
|
||||
└── registers MenuViewModel, NavigationViewModel
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Stale XML Documentation**: The XML comment in `NavigationViewModel` constructor references `"TechnologyDoFrontEditViewModel"` which does not match the actual class name. Similarly, `MenuViewModel` references `"TechnologyDomainEditViewModel"`. These appear to be copy-paste artifacts from another codebase.
|
||||
|
||||
2. **Widespread NotImplementedException**: The majority of lifecycle methods (`Activated`, `Cleanup`, `CleanupAsync`, `InitializeAsync`, `IsDirty` getter) throw `NotImplementedException` across all ViewModels. This indicates incomplete implementation—callers must not rely on these methods.
|
||||
|
||||
3. **Inconsistent IsBusy Implementation**:
|
||||
- `ShellViewModel.IsBusy` throws `NotImplementedException`
|
||||
- `ViewerShellViewModel.IsBusy` is fully implemented with backing field
|
||||
- `NavigationViewModel.IsBusy` and `MenuViewModel.IsBusy` throw `NotImplementedException`
|
||||
|
||||
This inconsistency suggests `ViewerShellViewModel` is more complete than `ShellViewModel`.
|
||||
|
||||
4. **Commented-Out Critical Logic**:
|
||||
- `MainViewModel.OnAssemblyListChange()` is entirely commented out—the method receives `AssemblyListInfo` but does nothing with it.
|
||||
- `MainViewModel.ContextMainRegion` getter returns `null` and setter logic is commented out.
|
||||
- `MenuViewModel.CreateViews()` has `_regionManager.AddView` call commented out.
|
||||
|
||||
5. **new Keyword Hiding**: Several members use `new` to hide base class members:
|
||||
- `NavigationViewModel`: `PropertyChanged` event, `OnPropertyChanged` method, `IsBusy`, `IsDirty`, `CleanupAsync`
|
||||
- `MenuViewModel`: `IsBusy`, `IsDirty`, `CleanupAsync`
|
||||
- `MainViewModel`: `IsMenuIncluded`, `IsNavigationIncluded`
|
||||
|
||||
This may cause unexpected behavior when casting to base types.
|
||||
|
||||
6. **Placeholder Code**: Multiple `Initialize` methods contain placeholder statements like `int i = 10;` or `var s = String.Empty;` that serve no functional purpose—likely debug artifacts.
|
||||
|
||||
7. **Duplicate Shell Implementations**: Both `ShellViewModel` and `ViewerShellViewModel` implement `IViewerShellViewModel` and have nearly identical structure. The relationship between these two classes is unclear from source alone—they may represent different shell configurations or be a refactoring in progress.
|
||||
|
||||
8. **ThreadOption.PublisherThread in Event Subscription**: `
|
||||
Reference in New Issue
Block a user