I'm wondering if anyone has some pointers and/or a good guide on how to properly do events in the .Net Micro Framework.
I've gotten a Netduino and is playing around making a small wrapper framework around various components and I'm trying to make it sort of event driven. Started doing it the way I'm used to, but discovered there were several classes and interfaces in the Microsoft.SPOT
namespace which seems event related, and I haven't used any of them before. For example:
- Dispatcher
- DispatcherFrame
- DispatcherObject
- DispatcherOperation
- DispatcherTimer
- EventHandlersStore
- EventRoute
- EventSink
- IEventListener
- IEventProcessor
- RoutedEvent
And several more. How do I use all these properly? Should I use them?
As an example I'd like to create a wrapper around a photo/light sensor which raises an event whenever the light level changes. For this (I suppose?) I need to poll the value of an analog pin and see if it changes. I can do that pretty simply by firing off an observer on a separate thread or something like that. But is there an other way I should do this? I guess for example that I shouldn't have a thread per sensor as that could become quite many and the resources are pretty limited here?