dbus-sharp
dbus-sharp copied to clipboard
How to emit signals with dbus-sharp?
I must be missing something, how would I emit a signal from dbus-sharp? I looked through the examples but don't see anything that looks analogous.
And I'll answer my own question:
- Add an event to your dbus object class, like:
public class Blah : MarshalByRefObject
{
public event MyEventHandler OnEvent;
public void EventHandler()
{
if(OnEvent != null) { OnEvent(); }
}
}
- Run 'dbus-monitor' to watch the dbus activity on your system
- Call Blah's EventHandler() method and see that the 'OnEvent' signal was sent from your dbus object.