public void SetCloseCallback(ULCloseCallback callback, IntPtr userData = default) { if (callback is not null) { ULCloseCallback__PInvoke__ callback__PInvoke__ = (user_data, window) => callback(user_data, new ULWindow(window)); if (handles[0].IsAllocated) { handles[0].Free(); } handles[0] = GCHandle.Alloc(callback__PInvoke__, GCHandleType.Normal); AppCoreMethods.ulWindowSetCloseCallback(Ptr, callback__PInvoke__, userData); } else { if (handles[0].IsAllocated) { handles[0].Free(); } handles[0] = default; AppCoreMethods.ulWindowSetCloseCallback(Ptr, null, userData); } }
internal static extern void ulWindowSetCloseCallback(IntPtr window, ULCloseCallback callback, IntPtr user_data);
public static extern void ulWindowSetCloseCallback(ULWindow window, ULCloseCallback callback, IntPtr user_data);