Results 1 to 6 of 6

Thread: Plugins/Add-ons application

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Plugins/Add-ons application

    Hi,

    we have an vb.net application with serveral assemblies. is it possible, or do you guys have sample codes that will have my project to have a plugins or addons feature. ?? so that in future updates i could just send them addons and the new feature of the software will available without re-installing the application.

    thanks,

    alexis

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Plugins/Add-ons application

    Adding in such functionality after the fact would be mighty difficult. I did something like this for a program I was working on, but it was designed to work that way right from the start. What I did was create a few interfaces that were in a common dll. The program new how to work with those interfaces. Therefore, a new plug-in could be created by creating a dll that referenced the common dll (to have the interface definitions) and exposing at least one class that implemented one of the interfaces. When the main program started, it examined all the dlls it had and enumerated all of the interfaces it found. If a class in one of the dlls implemented interface A, the main program would note that it implemented interface A, and create an instance of that class cast to interface A. The main program would then interact with this object as an interface A. What the object actually was could be all over the board. Technically, it could have been an entire program. All the interface did was to provide an icon, some strings to use in menus, tooltips, and the like, and a function to call when the icon or menu item was selected. This made the main program nothing more than a shell that figured out which plug-ins it had, displayed icons for them, and relayed information to them when they were clicked.

    I don't see any reasonable way to add that kind of functionality in after the fact without some serious re-writing. On the other hand, you could certainly use the same technique. If you have menus, the interface would have to indicate which menu to add to, and what to add. It would also have to have a method that would be called on the menu item click. This would have to be hooked up dynamically, too, but that is pretty easy. I could give you some examples, but the whole thing is kind of sprawling, so it would have to be narrowed down somewhat.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Plugins/Add-ons application

    Hi there,
    well said. and thank you very much. you sample will be highly appreciated.
    more power to you


    alexis

  4. #4
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Plugins/Add-ons application

    Read this topic http://www.codeproject.com/Articles/...ecture-using-C to learn the basics of writing plugin-based applications, it uses C# but the code is easy enough to convert to VB.



  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Plugins/Add-ons application

    thanks a lot, we'll take a look at it.

  6. #6
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: Plugins/Add-ons application

    You may want to investigate MEF from Microsoft (not sure whether it's a standard part of the .NET framework yet or if you need to download it separately)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width