0

I have an assembly which generates a Form (it is a client-software). I can build an app getting and starting (Show) that form without any problem. But I cannot start that Form twice because the assembly does not provide a clean capsuled solution. Every second start it would crash because several things will not initialize successful a second time. Unfortunately that assembly cannot be modified.

Now I have put that in a seperate AppDomain to be able to unload that assembly. This works fine and the hosting application can now start that Form multiple times.

Now the problem is: I have a WPF-app which should not show that assembly's Form, it should contain it in one of its own windows. The WinForms Form of the assembly is already in a WindowsFormHost and WPF-Window (with AssemblyAppDomain). But I cannot assign the WPF-Window as Content of one of the main WPF-app-windows. It is in the AssemblyAppDomain AppDomain (and object space is not shared with that).

As far as I searched up to now it should be possible to establish a connection between two WPF windows in different AppDomains because that is kind of the way System.AddIn works. Should work with a Pipeline, Contract and FrameworkElementAdapter. I am somewhat stuck and any more specific hints will be appreciated!

ZoolWay
  • 5,411
  • 6
  • 42
  • 76

1 Answers1

2

Have you checked the docs about WPF addins? Also check out this example.

bitbonk
  • 48,890
  • 37
  • 186
  • 278
  • The example looks much better than anything I found before. I'll give it a try to use the complete AddIn-functionality. – ZoolWay Jan 13 '11 at 09:51
  • Your example link and http://msdn.microsoft.com/en-us/library/bb909974.aspx helped me a lot. I was wondering how to use the pipeline mechanism without having to implement the complete addon-functionality. In the end once you know it using System.AddIn is not too difficult and on the other hand very powerful. Thanks for directing my mind in the right direction ;) – ZoolWay Jan 13 '11 at 15:42