MainForm.cs

MainForm.cs is the main Windows Forms UI and the highest-level orchestration point for editor actions, file loading, export validation, AI panel behavior, and Juno bridge commands. desktop ui

Main role

This script coordinates user actions. It should not be treated as the conversion source of truth; that belongs to VizzyXmlConverter.cs and VizzyExportValidator.cs.

Responsibilities

AreaBehavior
File loadingOpens craft XML, Vizzy XML, and code files.
Code editorDisplays and highlights .vizzy.cs.
Save codeWrites current editor content.
Save XMLRestores sidecar metadata, converts code, validates XML, saves output.
Tree viewDisplays parsed program structure.
Juno bridgeConnects, browses parts, imports/exports Vizzy, saves telemetry/snapshots.
ReportsCalls JunoReportBuilder.cs for Markdown reports.
ThemeApplies light/dark UI styling.

Save To XML Flow

flowchart TD
    A[Editor code] --> B[Load sidecar if available]
    B --> C[CodeCleanView.RestoreExactCode]
    C --> D[VizzyXmlConverter.ConvertCodeToXml]
    D --> E[VizzyExportValidator.Validate]
    E -->|Pass| F[Save XML]
    E -->|Fail| G[Show blocking error]

Bridge Flow

sequenceDiagram
    participant UI as MainForm
    participant JC as JunoClient
    participant Bridge as Juno Bridge
    UI->>JC: GetStatusAsync
    JC->>Bridge: GET /status
    Bridge-->>JC: JSON
    JC-->>UI: StatusInfo

Key Dependencies

DependencyPurpose
CodeCleanView.csClean-view sidecar restoration.
VizzyXmlConverter.csConversion engine.
VizzyExportValidator.csExport safety gate.
JunoClient.csLocal bridge operations.
JunoReportBuilder.csHuman/AI report generation.

Related notes: Component Map, 01 - Project Architecture, 06 - Juno Live Bridge, 14 - Troubleshooting.