IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

C# Enable Winform Plugin

, This article enables your C# Winform application to have flexible menu

innosia
no avatar
Super Member
*********
Group: [HOSTED]
Posts: 236
Joined: 29-August 08
Member No.: 67,024



Post #1 post Aug 29 2008, 03:41 PM
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
{
InitializeComponent();
MenuManager _manager = new MenuManager();
_manager.UpdateFile();

_manager.AddPluginToStrip(menuStrip1);
_manager.AddMenuItemClickEvent(menuStrip1, _item_Click);
}

_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 : jokenjp@yahoo.com

Attached File(s)
Attached File  MenuPlugin.zip ( 258.55K ) Number of downloads: 7
 
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 gta 652 15th November 2004 - 05:09 PM
Last post by: simipro
No New Posts   0 techfreakorama 527 17th July 2006 - 03:21 PM
Last post by: techfreakorama
No New Posts   1 seba1killer 181 10th July 2008 - 04:38 AM
Last post by: jlhaslip
No New Posts   5 gpinvest 1,034 15th October 2006 - 04:41 PM
Last post by: joesurf
No New Posts   4 -netdroid9- 287 30th November 2004 - 03:04 PM
Last post by: -deheleri-
No New Posts   0 -mehijoon- 236 16th January 2005 - 10:09 PM
Last post by: -mehijoon-
No New Posts   0 -italo- 239 23rd January 2005 - 10:32 AM
Last post by: -italo-
No New Posts   12 snlildude87 1,789 3rd January 2008 - 11:44 PM
Last post by: hitmanblood
No New Posts   4 E-Sector 1,882 8th October 2005 - 11:45 AM
Last post by: sonyguy
No New Posts   4 SvVifT 554 9th December 2005 - 09:00 PM
Last post by: cmatcmextra
No New Posts   2 fffanatics 1,079 8th June 2006 - 04:15 AM
Last post by: amhso
No New Posts   3 Dumbledore 537 28th May 2006 - 04:46 PM
Last post by: sportytalk
No New Posts   1 itssami 3,133 12th April 2006 - 04:23 PM
Last post by: shadowx
No New Posts   2 kawasu 1,018 12th January 2007 - 03:14 PM
Last post by: kawasu
No New Posts   0 Jarlaxe 726 30th May 2007 - 10:39 AM
Last post by: Jarlaxe


 



RSS Lo-Fi Version Time is now: 4th December 2008 - 09:06 PM