Subscribe only to implemented events #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before subscribing to an event we check wether the VFP handler actually has a method to handle the event. Only if it does we subscribe to the event. This change lets us selectively implement only the events we are interested in, instead of having to implement all events.
Some .NET types implement lots of events and behave differently when an event is being subscribed. For instance, they might not collect and provide event data if there's no subscriber. Even though they shouldn't sometimes types expect a certain behavior from event handlers or alter the default behavior based on just the existence of a subscriber.
Two minor changes are included: Fixed typos (sorry!) and consistently use the SetError method instead of mixing direct assignments to the property with SetError calls. This makes it easier to subclass wwDotNetBridge when our application has its own logging scheme and we want to log all errors as they occur instead of checking after every call to wwDotNetBridge.
I've not recompiled wwDotNetBridge.DLL to avoid binary conflicts. For the same reason I've not updated the Examples directory with the updated PRG and DLL, nor did I remove the outdated PDB file.