Files
DP44/enriched-partialglm/Common/DTS.CommonCore/Resources.md
2026-04-17 14:55:32 -04:00

3.9 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Resources/ResourceNames.cs
Common/DTS.CommonCore/Resources/MainTabControlResource.xaml.cs
2026-04-16T11:58:21.847018+00:00 zai-org/GLM-5-FP8 1 37911183d8b2e17a

Documentation: Resources Module

1. Purpose

This module provides UI-related resource definitions for the application. It consists of a constants class for animation storyboard naming conventions and a code-behind partial class that centralizes tooltip event handling by bridging WPF UI events to the Prism event aggregation system. The module exists to standardize transition animation names and decouple tooltip handling logic from individual UI components.


2. Public Interface

ResourceNames (class)

Namespace: Athena.Resources
Accessibility: internal static

Member Type Value
EntryStoryboardName const string "InTransition"
ExitStoryboardName const string "OutTransition"

These constants define the expected names for entry and exit transition storyboards used in UI animations.


MainTabControlResource (class)

Namespace: DTS.Common.Resources
Accessibility: public partial

ToolTipEventHandler

public void ToolTipEventHandler(object sender, System.Windows.Controls.ToolTipEventArgs e)

Handles WPF ToolTip events by:

  1. Marking the event as handled (e.Handled = true)
  2. Retrieving an IEventAggregator instance via ServiceLocator.Current.GetInstance<IEventAggregator>()
  3. Publishing a HelpTextEvent with a HelpTextEventArg payload containing the original sender and ToolTipEventArgs

3. Invariants

  • Storyboard naming convention: All entry transition storyboards must be named "InTransition" and exit transition storyboards must be named "OutTransition" as defined by ResourceNames.
  • Event handling: ToolTipEventHandler always marks the ToolTipEventArgs as handled before publishing the event.
  • Service locator availability: ToolTipEventHandler assumes ServiceLocator.Current is properly configured and can resolve IEventAggregator. A null ServiceLocator.Current or failure to resolve IEventAggregator will throw an exception.

4. Dependencies

This module depends on:

  • System.Windows.Controls — for ToolTipEventArgs and WPF control types
  • DTS.Common.Events — for HelpTextEvent and HelpTextEventArg
  • Microsoft.Practices.ServiceLocation — for ServiceLocator
  • Microsoft.Practices.Prism.Events — for IEventAggregator

Consumers:

  • The ResourceNames class is internal, so only code within the same assembly can reference it.
  • MainTabControlResource is public partial, suggesting it is paired with a XAML resource file (MainTabControlResource.xaml) that likely defines styles or control templates referencing ToolTipEventHandler.

5. Gotchas

  • Namespace inconsistency: ResourceNames resides in Athena.Resources while MainTabControlResource is in DTS.Common.Resources. This may indicate the files originated from different projects or a historical renaming effort. The relationship between these namespaces is unclear from source alone.
  • Service Locator anti-pattern: ToolTipEventHandler uses the Service Locator pattern (ServiceLocator.Current.GetInstance<T>()), which can make testing and dependency tracking more difficult compared to constructor injection.
  • Silent failure risk: If ServiceLocator.Current is not initialized (e.g., during unit tests or before the container is set up), the handler will throw. There is no defensive null check.
  • Partial class without visible XAML: The partial modifier on MainTabControlResource indicates a code-behind file for a XAML resource, but the associated .xaml file is not provided, so the full context of how ToolTipEventHandler is wired is unknown.