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

ClassTypePurpose
DesignTimeBeepServiceManagerStaticManages design-time service resolution and DI container
ThemePreviewHelperStaticGenerates theme preview thumbnails for theme picker
ControlValidationHelperStaticValidates control configurations at design time
ControlPresetHelperStaticApplies preset configurations to controls
DesignTimeDataHelperStaticGenerates sample data for design-time previews
ProjectHelperStaticIntegration with Visual Studio project system
ProjectFileHelperStaticFile operations within the VS project
ResxResourceHelperStaticManages embedded resources in .resx files
ResourceValidationHelperStaticValidates resource references
ProjectResourceEmbedderStaticEmbeds files as project resources
FileOperationHelperStaticSafe 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 database

ThemePreviewHelper

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);