Files

93 lines
5.5 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/obj/x86/Debug/Dialogs/NotificationWindow.g.i.cs
- Common/DTS.Common/obj/x86/Debug/Dialogs/NotificationWindow.g.cs
- Common/DTS.Common/obj/x86/Debug/Dialogs/ConfirmationWindow.g.cs
- Common/DTS.Common/obj/x86/Debug/Dialogs/ConfirmationWindow.g.i.cs
generated_at: "2026-04-17T15:37:50.866970+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "36f77dfe5ce8c20c"
---
# Documentation: DTS.Common.Dialogs
## 1. Purpose
This module provides WPF dialog window components for user interaction within the DTS.Common library. It contains auto-generated partial classes for `NotificationWindow` and `ConfirmationWindow`, which serve as standard UI dialogs for displaying notifications and confirmation prompts respectively. These classes are generated by the WPF build process from XAML definitions and implement `IComponentConnector` to support XAML element naming and event binding.
---
## 2. Public Interface
### NotificationWindow
**Class:** `DTS.Common.Dialogs.NotificationWindow`
**Inheritance:** `System.Windows.Window`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DTS.Common;component/dialogs/notificationwindow.xaml`. Idempotent—returns early if already called. |
| `Connect(int, object)` | `void IComponentConnector.Connect(int connectionId, object target)` | Internal method that wires named XAML elements to their code-behind fields and attaches event handlers. Not intended for direct use. |
**Internal Fields (XAML-named elements):**
- `notificationWindow` — Self-reference to the window instance (line 7 of XAML)
- `LayoutRoot``System.Windows.Controls.Grid` container (line 45 of XAML)
- `OKButton``System.Windows.Controls.Button` for dismissal (line 63 of XAML)
**Event Handler (referenced):**
- `CoppyToClibord_Click``System.Windows.RoutedEventHandler` attached to an unnamed button's `Click` event (line 62 of XAML). **Note:** Implementation resides in the non-generated code-behind file (not provided).
---
### ConfirmationWindow
**Class:** `DTS.Common.Dialogs.ConfirmationWindow`
**Inheritance:** `System.Windows.Window`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DTS.Common;component/dialogs/confirmationwindow.xaml`. Idempotent—returns early if already called. |
| `Connect(int, object)` | `void IComponentConnector.Connect(int connectionId, object target)` | Internal method that wires named XAML elements to their code-behind fields. Not intended for direct use. |
**Internal Fields (XAML-named elements):**
- `confirmationWindow` — Self-reference to the window instance (line 6 of XAML)
- `LayoutRoot``System.Windows.Controls.Grid` container (line 27 of XAML)
- `OKButton``System.Windows.Controls.Button` for confirmation (line 45 of XAML)
- `CancelButton``System.Windows.Controls.Button` for cancellation (line 53 of XAML)
---
## 3. Invariants
- **Single Initialization:** `InitializeComponent()` must only be called once per instance. Subsequent calls return immediately without reloading the XAML.
- **Partial Class Requirement:** Both `NotificationWindow` and `ConfirmationWindow` are `partial` classes. The actual business logic, event handler implementations, and additional members must be defined in companion code-behind files (e.g., `NotificationWindow.xaml.cs`).
- **XAML Resource Availability:** The XAML resources at `/DTS.Common;component/dialogs/notificationwindow.xaml` and `/DTS.Common;component/dialogs/confirmationwindow.xaml` must be embedded in the assembly for `Application.LoadComponent` to succeed.
- **Connection IDs:** The `Connect` method uses hardcoded `connectionId` values (14). These must remain synchronized with the XAML compilation output.
---
## 4. Dependencies
**This module depends on:**
- `System.Windows` (WPF core)
- `System.Windows.Controls`
- `System.Windows.Markup` (`IComponentConnector`)
- `Microsoft.Xaml.Behaviors` (behavior libraries referenced in imports)
- `Microsoft.Windows.Controls` (extended controls)
- `PresentationBuildTasks` (code generation, runtime version 4.0.30319.42000)
**Consumers:**
- Unknown from source alone. These dialogs are likely consumed by other modules within the DTS system that require user notification or confirmation.
---
## 5. Gotchas
1. **Typo in Event Handler Name:** The event handler `CoppyToClibord_Click` contains spelling errors ("Coppy" instead of "Copy", "Clibord" instead of "Clipboard"). This typo exists in the XAML and propagates to the generated code. The actual implementation method in the code-behind must match this exact spelling.
2. **Auto-Generated Files:** The provided source files (`.g.cs` and `.g.i.cs`) are auto-generated and should not be manually edited. Any changes will be overwritten on recompilation. Modifications must be made in the corresponding `.xaml` and `.xaml.cs` files.
3. **Missing Code-Behind:** The actual implementations of `CoppyToClibord_Click` and any additional logic are not present in these generated files. The behavior of these dialogs cannot be fully understood without the companion `.xaml.cs` files.
4. **Duplicate Files:** Both `.g.cs` and `.g.i.cs` variants are provided for each window. These are functionally identical in content; the `.g.i.cs` variant is used for IntelliSense during design-time, while `.g.cs` is used at compile-time.