![]() ![]() ![]() This is required since main application does not reference the plugin project (which is what we want) so the plugin assembly is not automatically copied to main application directory. All we need now is to rebuild the solution, then copy the PluginCalculator.dll from its bin directory to our main application “plugins” directory. The Export attribute is beain read by MEF and informs about what type of interface we export here.Īnd that is basically it. The goal is to have a different views (UserControls for the record), each in separate dll, be able to be import as a plugin and embed in our main application.ġ: using InternalShared 2: using 3: using 4: using System.IO 5: using System.Reflection 6: using 7: 8: public class MainWindowModel : NotifyModelBase 9: The purpose of ImportPluginCommand command is to import the plugin view and assign it to PluginView property to be displayed in content control. Thus I will limit the content of this post to absolute minimum, providing you a solution for implementing plugins in WPF MvvM application. There is a lot information on the web regarding MEF, for instance From Zero to Proficient with MEF, an excellent post for those who start with MEF or this tutorial. Net Framework since version 4.0, so we need no extra libraries or packages to start working with MEF. In some scenarios it is very similar to Dependency Injection, but is rather focused on one primary purpose: Import and Export of objects. ![]() ![]() MEF is a tool that may facilitates extending and decoupling your application. In this post I will show you the way we can implement a plugin functionality in WPF MvvM application with use of Managed Extensibility Framework (MEF). By Mirek on (tags: MEF, mvvm, Plugins, WPF, categories: architecture, code) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |