Files
2026-04-17 14:55:32 -04:00

78 lines
5.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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-16T02:57:31.657940+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5aeec8a3a4ec19d3"
---
# Documentation: NotificationWindow and ConfirmationWindow Classes
## 1. Purpose
This module contains auto-generated WPF window classes used for displaying simple notification and confirmation dialogs within the `DTS.Common.Dialogs` namespace. `NotificationWindow` provides a modal dialog with a single OK button (and a hidden copy-to-clipboard button referenced in generated code), while `ConfirmationWindow` provides a modal dialog with OK and Cancel buttons for user confirmation flows. These classes are generated from corresponding XAML files (`NotificationWindow.xaml` and `ConfirmationWindow.xaml`) and serve as the code-behind for lightweight, standardized UI prompts in the application.
## 2. Public Interface
Both classes are partial and inherit from `System.Windows.Window`. They implement `System.Windows.Markup.IComponentConnector` to support WPF's XAML loading and event wiring.
### `NotificationWindow`
- **`public void InitializeComponent()`**
Initializes the window by loading its XAML definition from `/DTS.Common;component/dialogs/notificationwindow.xaml`. Ensures initialization occurs only once via `_contentLoaded` flag.
- **`void IComponentConnector.Connect(int connectionId, object target)`** *(explicit interface implementation)*
Connects XAML-declared UI elements to fields in the generated code-behind. Handles four connection IDs:
- `1`: Assigns `this.notificationWindow` (self-reference).
- `2`: Assigns `LayoutRoot` (Grid).
- `3`: Attaches `CoppyToClibord_Click` handler to a buttons `Click` event (note: method name appears misspelled — *CoppyToClibord_Click*).
- `4`: Assigns `OKButton` (Button).
### `ConfirmationWindow`
- **`public void InitializeComponent()`**
Initializes the window by loading its XAML definition from `/DTS.Common;component/dialogs/confirmationwindow.xaml`. Ensures initialization occurs only once via `_contentLoaded` flag.
- **`void IComponentConnector.Connect(int connectionId, object target)`** *(explicit interface implementation)*
Connects XAML-declared UI elements to fields in the generated code-behind. Handles four connection IDs:
- `1`: Assigns `this.confirmationWindow` (self-reference).
- `2`: Assigns `LayoutRoot` (Grid).
- `3`: Assigns `OKButton` (Button).
- `4`: Assigns `CancelButton` (Button).
> **Note**: No custom logic (e.g., event handlers, properties, or methods beyond initialization) is defined in these generated files. All business logic must reside in the corresponding partial class definitions (e.g., `NotificationWindow.xaml.cs`), which are not provided here.
## 3. Invariants
- `_contentLoaded` is `false` before first call to `InitializeComponent()` and `true` afterward; subsequent calls to `InitializeComponent()` are no-ops.
- UI element fields (`LayoutRoot`, `OKButton`, `CancelButton`, `notificationWindow`, `confirmationWindow`) are assigned exactly once during `Connect()` based on `connectionId`.
- `NotificationWindow` expects a button (likely `OKButton`) to have a `Click` event handler named `CoppyToClibord_Click` defined elsewhere (in the non-generated partial class).
- `ConfirmationWindow` does not wire any event handlers in the generated code — event wiring for OK/Cancel must be done in the partial class.
## 4. Dependencies
### This module depends on:
- `System.Windows` (WPF core)
- `System.Windows.Markup` (for `IComponentConnector`)
- `System.Windows.Controls` (for `Window`, `Grid`, `Button`)
- `Microsoft.Windows.Controls` (likely Microsoft Expression SDK or similar)
- `Microsoft.Xaml.Behaviors.*` (various behavior namespaces — used in XAML, not directly in generated code)
### This module is depended upon by:
- Other parts of `DTS.Common` (e.g., code that instantiates `NotificationWindow` or `ConfirmationWindow`).
- XAML files (`NotificationWindow.xaml`, `ConfirmationWindow.xaml`) — the source from which this code is generated.
## 5. Gotchas
- **Typo in event handler name**: The generated code references `CoppyToClibord_Click` (likely intended to be `CopyToClipboard_Click`). Ensure the corresponding partial class defines this handler, or the app will throw a runtime `MissingMethodException` when the button is clicked.
- **No public constructors or properties defined here**: These classes are minimal and rely on the partial class (not provided) for constructor logic, content properties, or dialog behavior.
- **Hardcoded resource URI**: `InitializeComponent()` uses a fixed pack URI (`/DTS.Common;component/dialogs/notificationwindow.xaml`). Moving or renaming the XAML file will break initialization.
- **No explicit dialog result handling**: Unlike typical confirmation dialogs, `ConfirmationWindow` does not set `DialogResult` in the generated code — this must be handled manually in the partial class (e.g., on OK/Cancel button clicks).
- **Auto-generated files**: These files are regenerated on build; manual edits will be lost. Any custom logic must be placed in the corresponding `.xaml.cs` partial class.
- **Missing event wiring for `ConfirmationWindow`**: While `NotificationWindow` wires a `Click` handler in `Connect()`, `ConfirmationWindow` does not — OK/Cancel behavior must be wired explicitly in the partial class.
None identified beyond the above.