I have an application that supports plugins (MEF). The plugins are UserControls WPF, which imports services.
The user can select the required plugin from the main application menu.
To do this, I use the following loop:
foreach(IToolPlugin Plugin in ToolPlugins) { Plugin.Init(); MenuItem PluginMenuItem = Plugin.MenuItem;
This works very well for a single item. But as soon as I have more than one plugin, all menu items are executed by the delegate of the last loop. Or at least using the Plugin.Control of the last loop.
How can i fix this? Thanks for any help.
closures c # event-handling delegates
Marks
source share