wwDotNetBridge Examples
Allows you to capture events on a source object, by passing in a callback handler that maps the events of the target object with corresponding methods on the handler.
To handle events:
Create an Event Handler Object
Create aCustom
class that implements methods that match the events of the .NET object that fires events with aOn<EventName>
prefix. Each 'asdd' method's parameters should match the parameters of the .NET event delegate. You only need to implement the methods you want to listen to - other events are ignored.Create an Event Subscription
CallloBridge.SubscribeToEvents()
which binds a .NET event source object to a FoxPro event handler.Continue running your Application
Events are handled asynchronously in .NET and run in the background. Your application continues running and as events fire in .NET, theOn<Event>
methods are fired on the Event Handler object in FoxPro.Unsubscribe from the Event Subscription
When you no longer want to listen to events, callloSubscription.UnSubscribe()
. Make sure you do this before you exit FoxPro or you may crash VFP on shutdown.