AddHandler() public static method

public static AddHandler ( INativeEventObjectWrapper obj, int eventId, UnmanagedEventHandler handler ) : int
obj INativeEventObjectWrapper
eventId int
handler UnmanagedEventHandler
return int
Esempio n. 1
0
        public void RegisterEvent(IntPtr obj, int eventId, Delegate managedHandler, UnmanagedEventHandler nativeHandler, bool handledEventsToo)
        {
            if (managedHandler == null)
            {
                return;
            }

            int token = Events.AddHandler(obj, eventId, invoke_eventhandler_cb, destroy_eventhandler_cb, handledEventsToo);

            AddHandler(eventId, token, managedHandler, nativeHandler);
        }
Esempio n. 2
0
        public static void SetManagedPeerCallbacks(INativeEventObjectWrapper obj)
        {
            IRefContainer container = obj as IRefContainer;

            NativeMethods.event_object_set_managed_peer_callbacks(obj.NativeHandle,
                                                                  container == null ? null : NativeDependencyObjectHelper.add_strong_ref,
                                                                  container == null ? null : NativeDependencyObjectHelper.clear_strong_ref,
                                                                  NativeDependencyObjectHelper.mentor_changed);

            if (obj is INativeCollectionWrapper)
            {
                Events.AddHandler(obj, EventIds.Collection_ChangedEvent, native_collection_changed_callback);
            }
        }