I am trying to implement a WPF application but need to keep the form open after
showing results in the Powershell console. At present it closes each time.
$run.add_Click({
$form.DialogResult = $true #Triggers the ShowDialog() below.
})
if ($form.ShowDialog()) {
Write-Host -ForegroundColor Cyan "Search starting …"
}