Correct way to fire events from addin to host

Feb 3, 2009 at 11:37 AM
Hello,  I am working on a addin system for my windows service. All worked fine until I wanted to fire event from addin back to host (for example if FileSystemMonitor fired event Changed) and do some action based on this. I found some event samples, but they are a bit confusing for me. Some examples uses interfaces some standard EventHandler. Can you please advice me correct direction?

Feb 3, 2009 at 1:58 PM
I used the sample provided here at codeplex (Event Firing from Host and Add-In)
It describes events both ways and works for me, and I haven't found anything better yet...
I believe it's the best way if you need to use custom eventargs, if not, there may be an easier way...

Feb 3, 2009 at 4:44 PM
Thank you for your quick response. I took a deeper look at this Event example. I have to say that I am now more confused, but I assume that this is the way I should go. Some code seem to be auto generated, some manually modified. Anyways PipelineBuilder did not generate output that matches Event Sample generated code. Maybe I am just missing something, but it looks very complicated to me..

Feb 4, 2009 at 8:55 PM
I was the only who originally pinged Jesse a year ago to request the sample mentioned above.  My thanks again to him for obliging.   That being said, it still took me quite awhile to deconstruct and understand the provided bits in order to adapt them to my own needs (I didn't need to propagate events to an AddIn, just from for example).  Additionally, I wanted to get rid of all the PipelineBuilder cruft in order to be able to really, really understand what was going on.   Sometimes I am willing to accept a certain level of abstraction, sometimes not.   This was not one of those cases.  I don't know about others, but the level of mental bookkeeping required to keep everything straight when using System.AddIn is fairly high.   Additionally, the System.AddIn event sourcing/sinking scenario is probably one of the hardest conceptual nuts I've had to crack.  A lot of swearing and gnashing of teeth :) After reading this thread, I spent a number of hours yesterday extracting bits from a working codebase for a sample as a thank-you for the original sample.  It is super pedantic, as I find that's the way I learn best from samples- everything laid out in excruciating detail.  A lot of Console.WriteLine() action, etc. etc. as a quick way to see what gets "fired" when.  I've not yet contributed anything to CodePlex... what would be the absolute easiest way to get something published?  I've got a solution zipped up and ready to go.