插件示例 [英] Plugins Example
问题描述
我想知道是否有人可以向我展示将插件加载到控制台的示例,以扩展其可以处理的命令.我遇到困难的部分是打电话给插件.应用程序和插件都将被制作 由我.我还想知道是否有一种方法可以处理来自插件的事件.我当时正在考虑使用MEF进行所有这些操作.我阅读了很多有关MEF的内容,并尝试使用simplecalculator2示例,但由于其中存在几个不同的地方,这有点令人困惑 接口.感谢您的指导.
I wanted to know if anyone could show me an example of loading plugins to a console that would extend the commands it could handle. The part I am having a hard time with is making the calls to the plugin. Both the application and the plugin would be made by me. I also wanted to know if there was a way to handle events from a plugin. I was thinking about doing all this with MEF. I read a lot about MEF and tried playing with the simplecalculator2 example but it was a little confusing as there where several different interfaces. Thanks for the guidance.
推荐答案
MEF是处理此问题的好方法. 它可以处理事件(只需将事件添加到要导入的接口或基类中),并根据需要扩展命令.
MEF is a good way to handle this. It can handle events (just add an event to the interface or base class you're importing) as well as extending commands as needed.
此MSDN培训包括在VB中学习MEF的选项: http://msdn.microsoft.com /en-us/vs2010trainingcourse_introtomef_topic2.aspx
This MSDN training includes the option of learning MEF in VB: http://msdn.microsoft.com/en-us/vs2010trainingcourse_introtomef_topic2.aspx
这篇关于插件示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!