This sample might be helpful.
https://github.com/mcneel/Rhino5Samples_CPP/tree/master/SampleObjectEventWatcher