Design-Time Helpers
Supporting infrastructure classes for the Design.Server project — service management, theme preview, validation, project integration, and resource embedding
Table of Contents
Overview
Namespace: TheTechIdea.Beep.Winform.Controls.Design.Server.Helpers
Assembly: TheTechIdea.Beep.Winform.Controls.Design.Server.dll
The Helpers namespace contains supporting infrastructure for the design-time experience:
Helper Classes
| Class | Type | Purpose |
|---|---|---|
| DesignTimeBeepServiceManager | Static | Manages design-time service resolution and DI container |
| ThemePreviewHelper | Static | Generates theme preview thumbnails for theme picker |
| ControlValidationHelper | Static | Validates control configurations at design time |
| ControlPresetHelper | Static | Applies preset configurations to controls |
| DesignTimeDataHelper | Static | Generates sample data for design-time previews |
| ProjectHelper | Static | Integration with Visual Studio project system |
| ProjectFileHelper | Static | File operations within the VS project |
| ResxResourceHelper | Static | Manages embedded resources in .resx files |
| ResourceValidationHelper | Static | Validates resource references |
| ProjectResourceEmbedder | Static | Embeds files as project resources |
| FileOperationHelper | Static | Safe file operations with VS integration |
DesignTimeBeepServiceManager
Manages the design-time dependency injection container. When controls need services at design time (e.g., data access for sample data), this class provides mock implementations that work in the Visual Studio process.
// At design time, controls use mock services
var dataService = DesignTimeBeepServiceManager.GetService<IDataService>();
// Returns a design-time mock that generates sample data
// instead of connecting to a real databaseThemePreviewHelper
Generates small preview thumbnails for the theme picker dialog. Each thumbnail shows a mini rendering of key controls (button, textbox, grid) with the theme applied.
ControlValidationHelper
Validates control configurations at design time, providing warnings and errors in the Visual Studio Error List:
- Missing required properties
- Invalid property combinations
- Resource path validation
- Data binding configuration issues
Project Helpers
ProjectHelper
Provides integration with the Visual Studio project system: resolves project paths, manages assembly references, handles NuGet package detection.
ResxResourceHelper & ProjectResourceEmbedder
When a control uses embedded resources (images, icons, SVG files), these helpers manage adding the resources to the project's .resx file and setting appropriate build actions.
Examples
// Theme preview generation
var preview = ThemePreviewHelper.GeneratePreview("DarkTheme", 120, 80);
// Returns a 120x80 Bitmap showing theme preview
// Control validation
var issues = ControlValidationHelper.Validate(new BeepGridPro());
foreach (var issue in issues)
Console.WriteLine($"[{issue.Severity}] {issue.Message}");
// Project resource embedding
ProjectResourceEmbedder.EmbedResource(project, "icon.svg",
ResourceTypes.SvgImage);