Files
DP44/docs/ai/Common/DTS.Common/obj/x86/Debug/Themes.md

75 lines
4.5 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/obj/x86/Debug/Themes/CommonStyles.g.i.cs
- Common/DTS.Common/obj/x86/Debug/Themes/CommonStyles.g.cs
generated_at: "2026-04-17T15:41:10.196599+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "423da40d53f139d7"
---
# Documentation: CommonStyles (Auto-Generated)
## 1. Purpose
This module contains the auto-generated code-behind for `CommonStyles.xaml`, a WPF `ResourceDictionary` that defines centralized visual styles for the DTS.Common assembly. The generated class facilitates XAML parsing and connects event handlers—specifically `ToolTipOpeningEvent` handlers—to various styles defined in the XAML. This is build output from `PresentationBuildTasks` and should not be manually edited.
## 2. Public Interface
### Class: `DTS.Common.CommonStyles`
A `partial` class extending `System.Windows.ResourceDictionary` that implements `System.Windows.Markup.IComponentConnector` and `System.Windows.Markup.IStyleConnector`.
#### `public void InitializeComponent()`
Initializes the resource dictionary by loading the XAML component. Idempotent—subsequent calls return immediately if already loaded. Loads the resource at URI `/DTS.Common;component/themes/commonstyles.xaml` via `System.Windows.Application.LoadComponent()`.
#### `void IComponentConnector.Connect(int connectionId, object target)`
Explicit interface implementation. Sets `_contentLoaded = true`. No other behavior observed in the generated code.
#### `void IStyleConnector.Connect(int connectionId, object target)`
Explicit interface implementation. Connects `System.Windows.EventSetter` instances to styles based on `connectionId`. Creates `EventSetter` objects with:
- **Event**: `System.Windows.FrameworkElement.ToolTipOpeningEvent`
- **Handler**: A new `System.Windows.Controls.ToolTipEventHandler` wrapping `this.ToolTipEventHandler`
The handler is attached to 12 distinct styles (connection IDs 112), corresponding to XAML lines 39, 54, 703, 727, 771, 941, 996, 1050, 1659, 1826, 1912, and 1929 in `CommonStyles.xaml`.
#### `private bool _contentLoaded`
Tracks whether `InitializeComponent()` has been called.
## 3. Invariants
- **Idempotent Initialization**: `InitializeComponent()` may be called multiple times safely; it will only execute once.
- **Fixed Resource URI**: The XAML resource location is hardcoded as `/DTS.Common;component/themes/commonstyles.xaml` with `UriKind.Relative`.
- **Partial Class Contract**: The `ToolTipEventHandler` method referenced in `IStyleConnector.Connect()` must be defined in the non-generated portion of this partial class (not shown in provided source).
- **Connection ID Range**: Valid `connectionId` values for `IStyleConnector.Connect` are 112 inclusive.
## 4. Dependencies
### This Module Depends On:
- `System.Windows.ResourceDictionary`
- `System.Windows.Markup.IComponentConnector`
- `System.Windows.Markup.IStyleConnector`
- `System.Windows.Application`
- `System.Windows.EventSetter`
- `System.Windows.FrameworkElement`
- `System.Windows.Controls.ToolTipEventHandler`
- `Microsoft.Windows.Controls` (imported but usage not visible in generated code)
- Extensive WPF namespaces: `System.Windows.Controls`, `System.Windows.Media`, `System.Windows.Shapes`, etc.
### Build-Time Dependencies:
- `PresentationBuildTasks` version 4.0.0.0 (code generator)
### What Depends On This:
- **Unclear from source alone**. The `CommonStyles.xaml` resource dictionary is presumably merged into application-level or window-level resources, but consumers are not visible in this generated file.
## 5. Gotchas
- **Auto-Generated Code**: Both provided files are build outputs (`.g.i.cs` and `.g.cs`). Manual changes will be overwritten on rebuild. The actual implementation logic resides in `CommonStyles.xaml` and any accompanying hand-written code-behind.
- **Missing Partial Class Definition**: The `ToolTipEventHandler` method is referenced but not defined in the provided source. It must exist in the non-generated partial class file (likely `CommonStyles.xaml.cs`).
- **Duplicate Files**: The two provided files (`CommonStyles.g.i.cs` and `CommonStyles.g.cs`) are functionally identical. This duplication may result from different build configurations or intermediate output paths.
- **XAML Not Provided**: The actual style definitions, target types, and visual templates are in `CommonStyles.xaml`, which is not included. The generated code only reveals that 12 styles subscribe to `ToolTipOpeningEvent`.
- **Checksum Verification**: The pragma checksum directive references the original XAML file for integrity verification during builds.