Under Windows using WinUSBNotificationMBS it works fine.
The MBS example program, which subclasses MacUSBNotificationMBS to expose its events, also works fine, however I prefer not to use this method because it would degrade the encapsulation of my SerialConnector class.
No. The MBS notifications classes just provide events when a device is connected or disconnected, they don’t attempt any access, and besides, the devices I’m working with are USB-serial converters, not drives. And the MBS example works fine.
I’m gonna make a suggestion. Instead of using AddHandler with WeakAddressOf, try subclassing the MBS classes, implementing the events and then set up delegates. It gives you greater control, allows you to change the target on the fly, and even detect if you’ve forgotten to hook one of them up. The way I do this looks like this( I’ll use timer)
Class MyTimer as Timer
Delegate ActionDelegate()
Property ActionCallback as ActionDelegate
EventHandler Action()
If actionCallback <> Nil then
ActionCallback.invoke
End if
End EventHandler
End Class
Then instead of AddHandler, you just assign the address to ActionCallback.
That’s basically my workaround, and yes it works, but it’s ugly to have two extra classes is my project which wouldn’t be necessary if the plug-in worked; I’d prefer to have it all encapsulated in one class.