Design Considerations
A. PowerShell cannot run multiple independent forms.
a. PowerShell runs as a “console” application. A Windows Forms executable runs as a GUI executable.
b. A Windows main form or “MainWindow” runs as a modeless window. A GUI form can run other modeless forms. A GUI form is multithreaded and requires multiple threads to work correctly. PowerShell can only run “modal” form because PowerShell can only have one thread. While it is possible create new threads (runspaces) these cannot be easily coordinated with PowerShell.
c. PowerShell can only run one active form. An active form can open a child form as a modeless dialog, but the parent form will be frozen until the child dialog is closed.
d. A modal dialog cannot create a modeless dialog.Technorati Tags:
powershell,
forms
B. How to forcibly create independent forms in a single PowerShell session.
a. Use a separate Runspace.
Synchronizing forms can be a technical challenge
b. Use an MDI Window
This cannot be easily done with Sapien PowerShell Studio
c. Create a form using Visual Studio as a DLL and call the form from PowerShell.