D
Dave Weber
I'm in the process of writing an open-source plugin-enabled application.
I know that you can define the API in several ways, and right now it
is equipped as an Interface.
The gist of the functionality, is when a timer expires, the app will
notify the plugins that it's time for them to do their work. Now, the
plugins may take an indeterminate period of time (e.g.: they have
nothing to do, or they have a few seconds of work to do).
Now, I want to notify the user as to the status of the plugin via a
systemtray icon changing to a "busy" state. So currently, I have a
second timer running every second, which polls the plugins to ask them
if they're busy. This seems like an awefully bad practice, but it works.
I'm just wondering if it would be better to use some sort of callback
function so that the plugins can tell the manager "i'm busy" and "i'm
free" as opposed to a "ADHD kid w/ too much sugar-esque" "are you busy?
are you busy? are you busy?..."
If i'm better off using a delegate as a callback, do I have to abandon
the interface and move towards an abstract class?
I know that you can define the API in several ways, and right now it
is equipped as an Interface.
The gist of the functionality, is when a timer expires, the app will
notify the plugins that it's time for them to do their work. Now, the
plugins may take an indeterminate period of time (e.g.: they have
nothing to do, or they have a few seconds of work to do).
Now, I want to notify the user as to the status of the plugin via a
systemtray icon changing to a "busy" state. So currently, I have a
second timer running every second, which polls the plugins to ask them
if they're busy. This seems like an awefully bad practice, but it works.
I'm just wondering if it would be better to use some sort of callback
function so that the plugins can tell the manager "i'm busy" and "i'm
free" as opposed to a "ADHD kid w/ too much sugar-esque" "are you busy?
are you busy? are you busy?..."
If i'm better off using a delegate as a callback, do I have to abandon
the interface and move towards an abstract class?