I have a vb.net project that loads “plugin” dlls at runtime to crunch some data in slightly different ways and return the results. To do that, all the plugins implement the same interface, so the GUI couldn’t care less how the plugin arrives at its final dataset, just so long as all the plugins deliver it back to the GUI in the same way.
I’d like to set up per-plugin options in addition to the main program options. I have an options form that accepts an object of type System.Configuration.ApplicationSettingsBase and displays the contents in a PropertyGrid control, so it’ll show any My.Settings object the same way. Question is, how do I pull the My.Settings object out from a plugin that’s loaded at run-time?
Figured it out. I used the
My.Settingsfor each class library to hold the individual settings, and in my plugin interface, specified that each plugin should implement its ownRaiseOptions()method, which would create a new instance of an options form, push theMy.Settingsobject to the form, and then display those settings on the form’sPropertyGridcontrol. Since the plugin is doing the calling, it is set to use the correctMy.Settingsobject (rather than theMy.Settingsobject from the GUI).It did require adding a few references so that a class library could display a form properly, but IntelliSense was pretty good at pointing out exactly what I needed.