pros:
cons:
pros:
cons:
pros:
cons:
I'm going to use method #1. Can you recommend a better approach?
Are there any decent techniques based on CLR hosting in unmanaged DLLs ?
Note, that I'm aware of these questions:
As you know, dependency injection is a form of “inversion of the control” (IoC) programming principle. This means that classes don't create the objects they rely on. DI frameworks have containers responsible for revealing and resolving dependencies.
WPF Browser applications (or XAML Browser applications, or XBAP) are a specific kind of application that are compiled into . xbap extensions and can be run in Internet Explorer.
WPF only runs on windows. You can make a type of wpf application called xbap which runs in a browser.
on my old project, I was using CECIL (done for mono) which allow me to inject performance tracing code in any code. Sample is too big to be pasted here, but have a look to the project ReflectionStudio and especially this injector class - . It is allways available on mono/cecil web site - only thing is to take care of your request about the main UI thread.
Since a user put an open bounty on a question delivered nearly 9 years ago, I'll throw in an updated option I've used for a similar project:
The Prism framework for WPF is very well documented and solid. Now I'm not sure it's compatibility with Vista (original request 9 years ago) and I'm not sure that is important anymore. It contains a very MEF like function in its unity bootstrapper class such that you dynamically load what they call modules class libraries (which is really just XAML containers).
So you build out your module class libraries and at WPF shell runtime it scans your module directory in your container application for any of the module assemblies and dynamically loads via a module catalog (method of the Unity Bootstrapper) into the host container through predetermined regions. (sounds really MEF like huh?)
Now Brian Lagunas (http://brianlagunas.com) has an example posted that takes this a step further. His module catalog implementation continuously scans a directory so as dll's are added (during shell runtime) it picks the files up and processes them which in effect gives you the ability to add managed code on the fly. Add an upload button to the WPF shell that points to the module directory and utilizes Prism's Event Aggregator and you can flip the main title of the shell whenever a new module is loaded in.
Here is a link to Brian's post discussing loading modules at runtime: http://brianlagunas.com/prism-dynamically-discover-and-load-modules-at-runtime/
Link to GitHub example: https://github.com/brianlagunas/DynamicallyDiscover-LoadModules/
If you have never used Prism then highly suggest you watch Brian's crash course video. It is around 120 minutes and will get you going quickly with Prism even though the version is slightly outdated. http://brianlagunas.com/infragistics-webinar-mvvm-made-simple-with-prism-sample-code/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With