This page lists the steps in order. The runtime classes are described on the WinForms runtime page.

  1. Create the host: new WinFormFormHost { Dock = DockStyle.Fill }.
  2. Add each BlockDefinition to Definition.Blocks.
  3. Add a WinFormBlockHost with BlockName, Definition and Dock, and a WinFormBlockNavigationBar with BlockName. Set blockHost.NavigationBar before the manager is assigned.
  4. Add the controls to the form.
  5. Assign _formsHost.FormsManager = manager. This registers the blocks, connects the surfaces, refreshes the status bar and draws the menu.
  6. Assign FormFactory if the form calls other forms.
  7. Call RegisterBeepFormsMetadata(), the generated method that registers triggers, lists of values, rules and relations.
  8. After the form loads, call ExecuteQueryAsync("Ord") and MoveFirstAsync("Ord").

Assigning a manager is transactional. If it throws, the attempted blocks are unbound and the previous manager is restored.

Creating the manager

var manager = new FormsManager(editor);
Application.Run(new OrderEntryForm(manager));

A fuller constructor takes optional services, including alertProvider and editorProvider.

Block names

Block names are not case sensitive. Registering a second block with the same name throws "A block named 'name' is already registered." Automatic discovery skips duplicates without an error.

Threading

WinFormFormHost checks the owner thread. Its handle must be created on the thread that owns it before another thread uses it.

Status bar

WinFormFormStatusBar has Bind, Unbind and SyncFromManager and segments named PositionSegment, ModeSegment and ChangedSegment.