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

65 lines
3.9 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.CommonCore/Resources/ResourceNames.cs
- Common/DTS.CommonCore/Resources/MainTabControlResource.xaml.cs
generated_at: "2026-04-16T02:12:32.595603+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "37911183d8b2e17a"
---
# Resources
## Documentation: Resource Definitions and UI Event Handling
---
### 1. Purpose
This module provides centralized string constants for storyboard resource names used in UI transitions and a partial class implementing a tooltip event handler for help text propagation in the WPF UI layer. Specifically, `ResourceNames` defines stable identifiers for entry/exit transition storyboards, while `MainTabControlResource` facilitates contextual help by publishing `HelpTextEvent` events via Prisms `IEventAggregator` when tooltips are invoked.
---
### 2. Public Interface
#### `ResourceNames` (internal static class)
- **`EntryStoryboardName`** (`public const string`)
Value: `"InTransition"`. Represents the name of the storyboard used for entering a view/page.
- **`ExitStoryboardName`** (`public const string`)
Value: `"OutTransition"`. Represents the name of the storyboard used for exiting a view/page.
#### `MainTabControlResource` (public partial class)
- **`ToolTipEventHandler(object sender, ToolTipEventArgs e)`** (`public void`)
Handles `ToolTipOpening` events. Sets `e.Handled = true` to suppress default tooltip behavior, retrieves `IEventAggregator` via `ServiceLocator`, and publishes a `HelpTextEvent` with a `HelpTextEventArg` containing the original `sender` and `ToolTipEventArgs`.
---
### 3. Invariants
- `EntryStoryboardName` and `ExitStoryboardName` are compile-time constants and must not be modified at runtime.
- `ToolTipEventHandler` **must** be attached to a `ToolTipOpening` event (or similar) on a WPF control to function as intended.
- `ServiceLocator.Current` must be initialized and configured with a valid container that resolves `IEventAggregator`; otherwise, a runtime exception will occur.
- `HelpTextEventArg` constructor requires `Sender` and `E` parameters (as shown); no validation is performed beyond parameter passing.
---
### 4. Dependencies
#### This module depends on:
- **WPF**: `System.Windows.Controls.ToolTipEventArgs` and `partial class` support.
- **Prism Library**: `IEventAggregator`, `IEvent`, and `HelpTextEvent`/`HelpTextEventArg` types (not shown in source but referenced).
- **Microsoft.Practices.ServiceLocation**: `ServiceLocator` for resolving services.
- **DTS.Common.Events**: Namespace containing `HelpTextEvent` and `HelpTextEventArg` (inferred from `using DTS.Common.Events`).
#### This module is depended on by:
- UI XAML files (e.g., `MainTabControlResource.xaml`) referencing `EntryStoryboardName`/`ExitStoryboardName` as static resources.
- Event subscribers to `HelpTextEvent` (e.g., help service modules) that consume `HelpTextEventArg` to display context-sensitive help.
---
### 5. Gotchas
- **`internal` visibility**: `ResourceNames` is `internal`, so its constants are only accessible within the same assembly (likely `DTS.CommonCore`). External consumers must reference via fully qualified name *if* exposed elsewhere, but no public accessors exist.
- **Hardcoded storyboard names**: `"InTransition"` and `"OutTransition"` assume matching storyboard resources exist in XAML; mismatched names will cause silent transition failures (no compile-time check).
- **ServiceLocator usage**: Relies on the deprecated `ServiceLocator` pattern (Prism recommends constructor injection). This may complicate testing and violate DI best practices.
- **No error handling**: If `IEventAggregator` is not registered, `ServiceLocator.Current.GetInstance<IEventAggregator>()` throws an exception. No fallback or logging is present.
- **`e.Handled = true`**: Suppresses default tooltip behavior entirely—any other tooltip logic (e.g., static `ToolTip` property) will be overridden.
None identified beyond these.