This article enables your windows form application to have plugins. What is Plugins? Plugins are .dll assembly that is put in your application folder that enable your application to have extended features which uses separate codes instead of your main assembly file (exe files). The reasons to create plugin enabled application is that you can let other programmer to develop plugin for your application, then just plug the dll in the application, and your application is ready to use them without knowing. Joomla's components&modules or Winamp's Plugin is for these features.
In Short, the library gives you :
Your application will display new Form base on new .dll copy to your application's plugin folder. Each time you put a new file into this folder, your application will add a new menu, and when you click the new menu, it will display a new form provided by the .dll.
The downloaded zip files contain several projects, key project are
MenuPlugin.UI - This is the windows form that enabled menu plugin
MenuPlugin.Library - This is the main library files that searches for .dll that matches plugin interface and use it. It has features like displaying update plugin process from server, add click event to MenuItem and so on
MenuPlugin.Interface - This is the interface library between the application and the plugins
The MenuPlugins has several features
- The Plugins can be only located on server. And when the cllient starts the application, it will automatically looked for newest plugins or updated plugins from server, downloading it and using it. The process is now known by client user
- The plugins must be name "xxxxx - dllname.dll" xxxxx is menu location. For example of xxxxx see below
10000 - FILE
11000 - New
12000 - Close
13000 - Save
20000 - EDIT
21000 - Copy
22000 - Paste
30000 - VIEW
So you can create "10000 File.dll" and so on. This saves you troubles of handling plugins sort order in displaying in Menu. Or you can write your own plugins display method if you wish. The library makes you easy, so you just pass
public frmMain() // For exmaple frmMain is you windows form main class constructor
MenuManager _manager = new MenuManager();
_manager.UpdateFile() will download the new menus from server to current client computers, so you dont need to update your client copy of application one by one.
.AddPluginToStrip(menuStrip1) these creates your menu based on plugins. Dont worry if you have File and Edit menu already (for example), you just named the plugin "30000 Plugin.dll", "31000 Plugin1.dll" "32000 Plugin2.dll" and so on, and it will not mess with your already created menus
then AddMenuItemClickEvent, will make every MenuItem s created by AddPluginToStrip method have click event, remember to create _item_Click method on your own implementation, like showing the Plugin UserControl/Form in MDI Parent (this is implemented in this sample).
Download now the zip file from the attachment
Credit by me : John Kenedy
email me if you want something : email@example.com
hi I can Found the attachment!!!