Plugins as a service provider

Developer
Mar 8, 2011 at 1:08 PM

There are several times I've wanted to have one plugin do something (IE project all the files in a directory) from another plugin.  However I don't know of any mechanism to expose either the data or functions from one plugin to another in a non-binding way.

Right now we make it work by doing this in our download plugin:

 PluginInfo pi = getPluginInfo("CAMELOT-.2");
             cdsp= (CAMELOTDotSpatialPlugin)pi.plugin;
            foreach (var VARIABLE in cdsp.ProjList.Keys)
            {
                cmb_projList.Items.Add(VARIABLE);
            }

 

The problem there is that I have to have a reference to the CAMELOTDotSpatialPlugin in the code for the cast, which means it is a dependency to compile, which is a problem if anybody wants to use the code when CAMELOTDotSpatialPlugin isn't being used.

Do we have a generic way for plugins to communicate with each other via some generic data structure (IE a HashTable)?

 

Aaron Parks

RTI International

Coordinator
Mar 8, 2011 at 2:09 PM

In MapWindow 4 we had a generic message passing system where a plugin could send a message to all other plugins and they could take action on those messages or ignore them. Sounds like you need something similar here. - Dan

Developer
Mar 8, 2011 at 3:47 PM

I'm thinking something simple, either an interface to implement or even just a function in the IPlugin class.  All I really need a place to put some data (Hashtable or the like) and a way to signal the plugin to do something.  We could take the iTool idea of an execute function that could be over-ridden by the plugin to do the one thing it's good at.

 

Aaron Parks

RTI International

Coordinator
Mar 8, 2011 at 5:30 PM
If you see an obvious place in the plugin interface code to add this then please propose the code mod...

On Tue, Mar 8, 2011 at 9:47 AM, aparks <notifications@codeplex.com> wrote:

From: aparks

I'm thinking something simple, either an interface to implement or even just a function in the IPlugin class. All I really need a place to put some data (Hashtable or the like) and a way to signal the plugin to do something. We could take the iTool idea of an execute function that could be over-ridden by the plugin to do the one thing it's good at.

Aaron Parks

RTI International

Read the full discussion online.

To add a post to this discussion, reply to this email (DotSpatial@discussions.codeplex.com)

To start a new discussion for this project, email DotSpatial@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
Daniel P. Ames, Ph.D. PE
Associate Professor, Geosciences
Idaho State University - Idaho Falls
amesdani@isu.edu
geology.isu.edu
www.mapwindow.org


Developer
May 15, 2012 at 9:13 PM

Has there been any movement on this idea?  We would like to coordinate actions and pass data among a collection of plugins.  Perhaps we could hang an IEventManager off the AppManager with default behavior replicating the MW4 behavior.

 

Kurt Wolfe

U.S. EPA

Developer
May 15, 2012 at 11:40 PM
Edited May 16, 2012 at 8:40 PM

We're using MEF, instead.

Using MEF Contracts to Coordinate Communication Between Extensions (Advanced)