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

63 lines
4.0 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/Resources/ResourceNames.cs
- Common/DTS.Common/Resources/MainTabControlResource.xaml.cs
generated_at: "2026-04-16T02:52:26.561259+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7ab53012cf3e9cb3"
---
# Resources
## Documentation: `DTS.Common.Resources` Module
---
### 1. Purpose
This module provides shared UI resource definitions and event-driven tooltip handling for the main tab control in the application. It enables consistent naming of storyboard resources used for tab entry/exit transitions and centralizes the logic for publishing help-text events when tooltips are invoked on the main tab control—facilitating context-sensitive help functionality via Prisms event aggregation pattern.
---
### 2. Public Interface
#### `ResourceNames` (internal static class)
- **`EntryStoryboardName`** (`public const string`)
Constant string `"InTransition"`; represents the name of the storyboard used for tab entry animations.
- **`ExitStoryboardName`** (`public const string`)
Constant string `"OutTransition"`; represents the name of the storyboard used for tab exit animations.
#### `MainTabControlResource` (public partial class)
- **`ToolTipEventHandler(object sender, ToolTipEventArgs e)`** (`public void`)
Handles the `ToolTipOpening` event (or similar) for the main tab control. Sets `e.Handled = true` to prevent default tooltip behavior, resolves `IEventAggregator` from `ContainerLocator.Container`, and publishes a `HelpTextEvent` with a `HelpTextEventArg` containing the original `sender` and `ToolTipEventArgs`.
---
### 3. Invariants
- `EntryStoryboardName` and `ExitStoryboardName` are compile-time constants and must match storyboard resource keys defined in XAML (not visible here, but implied by usage).
- `ToolTipEventHandler` **must only be attached to events where `sender` is a WPF control and `e` is a `ToolTipEventArgs`**—otherwise, casting or event semantics may fail.
- `ContainerLocator.Container` is assumed to be initialized and contain a registered `IEventAggregator` instance before `ToolTipEventHandler` is invoked; failure to do so will cause a runtime exception (e.g., `NullReferenceException` or resolution failure).
---
### 4. Dependencies
#### Dependencies *of* this module:
- **`Prism.Ioc` / `Prism.Events`**: Used via `IEventAggregator`, `ContainerLocator`, and `HelpTextEvent`/`HelpTextEventArg` types.
- **`DTS.Common.Events`**: Contains `HelpTextEvent` and `HelpTextEventArg` types (not shown, but referenced).
- **WPF runtime types**: `System.Windows.Controls.ToolTipEventArgs`, `System.Windows.Controls.ToolTip`.
#### Dependencies *on* this module:
- XAML resources (not included) likely reference `ResourceNames.EntryStoryboardName` and `ResourceNames.ExitStoryboardName` as storyboard keys.
- UI components (e.g., `MainTabControl` in XAML) must wire `ToolTipEventHandler` to the appropriate tooltip event (e.g., `ToolTipOpening`) for help-text integration.
---
### 5. Gotchas
- `ContainerLocator.Container` is a static dependency—this introduces tight coupling and complicates unit testing; no DI container scoping is visible here.
- `e.Handled = true` suppresses default tooltip rendering; if custom tooltip content is expected elsewhere (e.g., via `ToolTipService`), this may cause tooltips to appear blank unless handled by downstream subscribers.
- `HelpTextEventArg` constructor is assumed to accept `sender` and `e` parameters, but its exact structure (e.g., property names, null-safety) is unknown from source.
- `MainTabControlResource` is declared `partial`, implying additional partial definitions exist (likely in `MainTabControlResource.xaml`), but their contents are not visible—behavior may depend on XAML-defined event wiring.
- **No null checks** are performed on `ContainerLocator.Container.Resolve<IEventAggregator>()` or `e`—runtime exceptions may occur if the container is uninitialized or `e` is null.
None identified beyond these.