# Common Consumer Patterns

These are the public patterns that should be preferred in consumer projects.

## Pattern: one MAS window per WinForms owner form

Use `MASApplication.AttachWindow(owner:=form)` for simple applications. Use `MASApplication.Create()` plus `CreateWindow(...)` when one application facade owns multiple windows.

## Pattern: create controls through `window.Controls`

Prefer:

```vb
Dim button As MASButton = window.Controls.AddButton("Save")
Dim grid As MASDataGrid = window.Controls.AddDataGrid()
```

Avoid creating parallel rendering or layout paths in consumer code.

## Pattern: use semantic layout intent

Prefer:

```vb
window.Controls.LayoutPage(Sub(page) page.FullWidth(control, MASSize.FillWidth))
```

or:

```vb
window.Controls.LayoutApplicationSurface(Sub(surface) surface.Workspace(Sub(page) page.FullWidth(control, MASSize.FillWidth)))
```

Avoid local `Left`, `Top`, `Width`, `Height` ownership for MAS controls unless a future public API explicitly documents it.

## Pattern: query capability before presenting an export option

```vb
Dim supported As Boolean = application.Output.CanExport(MASOutputArtifactKind.VisualCapture, MASOutputFormat.Png)
```

## Pattern: attach Nexamas UI-owned product/proof pages through public gateways

```vb
Dim dashboard As IDisposable = MASRenderVerification.AttachDashboard(window)
Dim localizationPage As IDisposable = MASLocalizationRtl.AttachPage(window)
```

The returned `IDisposable` should be kept and disposed when the host no longer needs the page.
