Choose which plugins are loaded

MrLucky

Freshman
Joined
Mar 5, 2006
Messages
47
Hi, I have a fully working plugin system now, but I always want to go further.

I want a CheckedListBox control with all plugins found in my plugins folder. I want that a user can select the plugins which he wants to use.

But how can I do this? does anyone this, or has a good tutorial?
 
I guess this depends on what exactly your Plugins do. It sounds like what you need to do is find a list of the available plugins and display this to the user. Then you only wish to instantiate (is that a word) the selected objects. The way I've done this in the past is to use 2 Interfaces instead of just one (thats assuming you are using an interface, ala the excellent example in the tutors corner). Basically you have an IPlugin and an IPluginInfo for each IPlugin object you create you also create an IPluginInfo object. This object contains information such as a name, an icon etc, plus a method called CreatePluginObject or something of this ilk. Your plugin controller then searches for these items and adds them to the checkbox list. When a user selects an item on the list you can then use the CreatePluginObject method to load in the actual plugin.

I hope that easy enough to understand. It might not be the best way of doing it, but thats the approach I would take.
 
You mean storing the list of which Plugins to load? Personally I'd store it as an xml file in the app directory. This could be done as part of your general application settings (if you have them). You can generate an xml file manually or use XmlSerialisation to serialise the class.
 
Back
Top