Is it possible to put a WinForms executed from ScriptRun into a container of the main application?

The main application is a WPF desktop app. The app ScriptRun compile and run is a WinForms app. I would like to put the WinForms form into the WindowsFormHost container.

Is that possible?

Thanks

Sure, you can embed a Windows Forms control created by Scripter into a WPF application. Here is a sample project which shows how to do that.

In case you would like to show a Windows.Forms.Form created by Scripter instead of embedding a Control, please use the following code:

  Form1 form = (System.Windows.Forms.Form)scriptRun.RunMethod("MyClass.CreateForm");
  WindowInteropHelper wih = new WindowInteropHelper(this);
  wih.Owner = form.Handle;
  form.ShowDialog();

Thanks Yevgeni. This is very helpful.

One more hurdle if possible: is it possible to do the same in the example code but the host and the Scripter are from different AppDomain?
The WPF host is on the main AppDomain while each Scripter instance is isolated in a separate AppDomain.

You can try an approach illustrated in this article:
WPF: Hosting WinForms Control from Another AppDomain - CodeProject

Thanks for the very useful link.