Overview

Namespace: TheTechIdea.Beep.Winform.Controls.Design.Server.Designers
Visibility: public sealed partial | Spread across 2 partial files after the original main file was deleted

BeepDocumentManagerDesigner provides the design-time experience for BeepDocumentManager -- the high-level coordinator for document management. It handles three document presentation modes (Tabbed, BrowserTabs, NativeMdi), auto-creates BeepDocumentHost instances via IDesignerHost.CreateComponent, exposes a setup wizard, and remembers user preferences in the Windows Registry. It does NOT use BaseBeepControlDesigner -- it likely extends ControlDesigner directly.

View Mode Management

MethodDescription
ApplyTabbedViewMode(showInfo)Configures the host with standard tabbed documents. Calls ApplyTabbedViewModeCore(browserStyle: false).
ApplyBrowserTabsMode(showInfo)Configures host with Chrome-style browser tabs (ShowAddButton=true, TabStyle=Chrome, CloseMode=Always, TabPosition=Top).
ApplyNativeMdiViewMode(showInfo)Falls back to tabbed mode with a message box explaining Native MDI is not yet supported.
ApplyLayoutTemplate(templateId)Maps wizard template IDs to concrete host template method calls (Single, SideBySide, Stacked, ThreeWay, etc.).

Setup Wizard

The setup wizard flow auto-opens when the component is first dropped on a form:

  1. Auto-detect -- InitializeNewComponent checks ShouldAutoOpenWizard() (registry key). If enabled, posts ShowSetupWizard().
  2. Wizard dialog -- Opens DocumentSetupWizardDialog with mode selection (Tabbed/BrowserTabs/NativeMdi), sample document seeding, layout template picker.
  3. Apply result -- ApplySetupResult(result) opens a designer transaction, applies the chosen mode, optionally seeds sample documents, and optionally applies a layout template.
  4. "Do not show again" -- Stored in registry. Can be reset via OnResetWizardPreference().

Host Resolution

// Auto-creates a BeepDocumentHost if one doesn't exist
private BeepDocumentHost? EnsureBeepDocumentHostExists(
    out string status, out bool autoCreated)
{
    // Uses IDesignerHost.CreateComponent(typeof(BeepDocumentHost))
    // Docks Fill, sends to back
    // Wires host to manager via Manager.Host + Hosts collection
}

When multiple hosts exist on the form, the wizard shows a HostPickerOption combo box to let the developer select which host to wire.

Registry-Based Wizard Preferences

MethodDescription
ShouldAutoOpenWizard()Static. Reads HKCU\Software\TheTechIdea\Beep\Design\DocumentSetupWizard\AutoOpen (DWORD). Returns true if key absent or non-zero.
SetAutoOpenWizard(bool)Static. Writes 1 (auto-open) or 0 (suppress) to the registry key.
OnResetWizardPreference()Resets to auto-open and shows a MessageBox confirmation.

Status Banner

DescribeViewMode() returns a human-readable status string shown in the smart-tag:

  • "Tabbed Documents · 3 docs · Top tabs · Splits allowed"
  • "Browser Tabs · 0 docs — drop a control on the host..."
  • "Not configured — click 'Setup Wizard...' to start."

Examples

// At design time:
// 1. Drop BeepDocumentManager from toolbox -> tray component
// 2. Setup Wizard auto-opens (if registry allows)
// 3. Choose "Browser Tabs" mode -> auto-creates BeepDocumentHost with Chrome style

// At runtime:
var mgr = new BeepDocumentManager();
mgr.ViewMode = DocumentViewMode.BrowserTabs;
var host = new BeepDocumentHost();
mgr.Host = host;
mgr.Hosts.Add(host);
host.AddDocument("Main.cs", new RichTextBox());
host.AddDocument("App.config", new TextBox());