96 lines
6.0 KiB
Markdown
96 lines
6.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- Common/DTS.CommonCore/Themes/CommonStyles.xaml.cs
|
||
|
|
- Common/DTS.CommonCore/Themes/BrushesAndColors.cs
|
||
|
|
generated_at: "2026-04-17T15:41:15.546262+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "f0384cf26124363a"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: DTS.Common Themes Module
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides centralized theme management for the DTS application, consisting of two components: `CommonStyles` (a code-behind partial class for XAML styling) and `BrushesAndColors` (a static cache for WPF brushes and colors). The module exists to provide consistent visual styling across the application while optimizing performance through cached resource lookups. It serves as the single source of truth for application colors and brushes, eliminating duplicate implementations (per comment referencing FB 33034).
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### CommonStyles (partial class)
|
||
|
|
|
||
|
|
**`void ToolTipEventHandler(object sender, System.Windows.Controls.ToolTipEventArgs e)`**
|
||
|
|
- Handles tooltip events from XAML UI elements.
|
||
|
|
- Marks the event as handled (`e.Handled = true`).
|
||
|
|
- Retrieves an `IEventAggregator` via `ServiceLocator.Current.GetInstance<IEventAggregator>()`.
|
||
|
|
- Publishes a `HelpTextEvent` containing a `HelpTextEventArg` with the sender and original event args.
|
||
|
|
|
||
|
|
### BrushesAndColors (abstract class - all static members)
|
||
|
|
|
||
|
|
**Cached Brush Properties** (all return `SolidColorBrush` unless noted):
|
||
|
|
|
||
|
|
| Property Name | Return Type | Resource Key Looked Up |
|
||
|
|
|---------------|-------------|------------------------|
|
||
|
|
| `Brush_ApplicationTileExport` | `SolidColorBrush` | `Brush_ApplicationTileExport` |
|
||
|
|
| `Brush__ApplicationTileCollectData` | `SolidColorBrush` | `Brush_ApplicationTileCollectData` |
|
||
|
|
| `Brush_ApplicationStatus_Failed` | `SolidColorBrush` | `Brush_ApplicationStatus_Failed` |
|
||
|
|
| `Brush_Dimmed_Text` | `SolidColorBrush` | `Brush_Dimmed_TextForeground` |
|
||
|
|
| `Brush_Application_Idle` | `SolidColorBrush` | `Brush_ApplicationStatus_Idle` |
|
||
|
|
| `Brush_ApplicationStatus_Complete` | `SolidColorBrush` | `Brush_ApplicationStatus_Complete` |
|
||
|
|
| `Brush_ApplicationStatus_Idle` | `SolidColorBrush` | `Brush_ApplicationStatus_Idle` |
|
||
|
|
| `Brush_ApplicationStatus_Busy` | `SolidColorBrush` | `Brush_ApplicationStatus_Busy` |
|
||
|
|
| `Brush_Run_SensorIdNotFound` | `SolidColorBrush` | `Brush_Run_SensorIdNotFound` |
|
||
|
|
| `Brush_Run_SensorIdOutOfPlace` | `SolidColorBrush` | `Brush_Run_SensorIdOutOfPlace` |
|
||
|
|
| `Brush_Table_AlternatingRowBackground` | `SolidColorBrush` | `Brush_Table_AlternatingRowBackground` |
|
||
|
|
| `Brush_Table_RowBackground` | `SolidColorBrush` | `Brush_Table_RowBackground` |
|
||
|
|
| `Brush_FlatControlPressedBackground` | `Brush` | `Brush_FlatControlPressedBackground` |
|
||
|
|
| `Brush_FlatControlPressedForeground` | `Brush` | `Brush_FlatControlPressedForeground` |
|
||
|
|
| `Brush_Transparent` | `Brush` | Creates new `SolidColorBrush(Colors.Transparent)` |
|
||
|
|
| `Brush_NoError` | `Brush` | From `/DTS.Common;component/Themes/brushes.xaml` |
|
||
|
|
| `Brush_Error` | `SolidColorBrush` | From `/DTS.Common;component/Themes/brushes.xaml` |
|
||
|
|
| `Brush_Warning` | `SolidColorBrush` | From `/DTS.Common;component/Themes/brushes.xaml` |
|
||
|
|
| `Brush_Attention` | `SolidColorBrush` | From `/DTS.Common;component/Themes/brushes.xaml` |
|
||
|
|
| `Brush_FlatControlDisabledForeground` | `Brush` | `Brush_FlatControlDisabledForeground` |
|
||
|
|
| `Brush_ApplicationContentForeground` | `Brush` | `Brush_ApplicationContentForeground` |
|
||
|
|
| `Brush_FlatControlDisabledBackground` | `Brush` | `Brush_FlatControlDisabledBackground` |
|
||
|
|
| `Brush_ApplicationStatus_Waiting` | `SolidColorBrush` | `Brush_ApplicationStatus_Waiting` |
|
||
|
|
| `Brush_ApplicationStatus_Failed_ActionBackground` | `SolidColorBrush` | `Brush_ApplicationStatus_Failed_ActionBackground` |
|
||
|
|
| `Brush_ApplicationStatus_Complete_ActionBackground` | `SolidColorBrush` | `Brush_ApplicationStatus_Complete_ActionBackground` |
|
||
|
|
| `Brush_ApplicationStatus_Failed_SystemProcess` | `SolidColorBrush` | `Brush_ApplicationStauts_Failed_SystemProcess` (note typo in resource key) |
|
||
|
|
| `Brush_ApplicationFooterBackground` | `SolidColorBrush` | `Brush_ApplicationFooterBackground` |
|
||
|
|
| `Brush_ApplicationLicensingFooterBackground` | `SolidColorBrush` | `Brush_ApplicationLicensingFooterBackground` |
|
||
|
|
| `Brush_Realtime_OSC_SELECTED` | `Brush` | `Brush_Realtime_OSC_SELECTED` |
|
||
|
|
| `Brush_Realtime_OSC_UNSELECTED` | `Brush` | `Brush_Realtime_OSC_UNSELECTED` |
|
||
|
|
| `Brush_Realtime_METER_SELECTED` | `Brush` | `Brush_Realtime_METER_SELECTED` |
|
||
|
|
| `Brush_Realtime_METER_UNSELECTED` | `Brush` | `Brush_Realtime_METER_UNSELECTED` |
|
||
|
|
| `Brush_SensorIdFound` | `SolidColorBrush` | `Brush_SensorIdFound` |
|
||
|
|
| `Brush_ArmSystemForeground` | `SolidColorBrush` | `Brush_ArmSystemForeground` |
|
||
|
|
| `Brush_ApplicationTilePrepare` | `SolidColorBrush` | `Brush_ApplicationTilePrepare` |
|
||
|
|
| `Brush_ApplicationTileSetup` | `SolidColorBrush` | `Brush_ApplicationTileSetup` |
|
||
|
|
| `BrushApplicationStatusPowerRed` | `SolidColorBrush` | `Brush_ApplicationStatusPowerRed` |
|
||
|
|
| `BrushApplicationStatusPowerYellow` | `SolidColorBrush` | `Brush_ApplicationStatusPowerYellow` |
|
||
|
|
| `BrushApplicationStatusPowerGreen` | `SolidColorBrush` | `Brush_ApplicationStatusPowerGreen` |
|
||
|
|
| `BrushFlatControlDarkForeground` | `SolidColorBrush` | `Brush_FlatControlDarkForeground` |
|
||
|
|
| `BrushApplicationStatusPowerClear` | `SolidColorBrush` | `Brush_ApplicationStatusPowerClear` |
|
||
|
|
|
||
|
|
**Color Properties** (all return `Color`, no caching, expression-bodied):
|
||
|
|
|
||
|
|
- `Color_ActionBackground`
|
||
|
|
- `Color_ApplicationTileCollectData`
|
||
|
|
- `Color_ItemBackground`
|
||
|
|
- `Color_ActionForeground`
|
||
|
|
- `Color_ItemForeground`
|
||
|
|
- `Color_ApplicationTileSetup`
|
||
|
|
- `Color_ApplicationTilePrepare`
|
||
|
|
- `Color_ApplicationTileCalibration`
|
||
|
|
- `Color_ApplicationTileExport`
|
||
|
|
- `Color_ApplicationTileAdmin`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 3. Invariants
|
||
|
|
|
||
|
|
1. **Brush Caching**: All brush properties use lazy initialization; once a brush is retrieved and frozen, the same instance is returned on subsequent accesses.
|
||
|
|
2. **Thread Safety**: Brushes are frozen via `.Freeze()` after creation, making them thread-safe and immutable.
|
||
|
|
3. **Resource Availability**: All resource keys referenced must exist either in the application's resource dictionary or in `/DTS
|