i am making a plugin style app..but i am facing a dilema...i have the plugins which will implement an interface(or maybe an abstract class i dont really know) so the mother class will know that every plugin have that given functions...but i want interaction between the plugins and the main class(Form)..for example, i want that my plugins give the url to the mother form and that form will do the download and in the end say to the plugin that the download has finished..but how the plugin will know the which function to call? will i have to make a interface that the form will have to implement too, so the plugin knows what are the form's functions?
..
if i wasnt explicit enough say it..i am almost asleep
It's a back/forth interaction. Have your plugin interface have some kind of init function:
Code:
interface IPlugin
{
// ...
public bool Init(IPluginHost);
}
where IPluginHost is an interface that provides methods with which the plugins can request info from your app. It could also expose events if interfaces can do that.
IPluginHost would be implemented by some of your classes (e.g. the main form) and a reference to this class be passed to every plugin as an IPluginHost.
All the buzzt CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.