Ejemplo n.º 1
0
        private static void RegisterNativeEventHandles()
        {
            int    size = Marshal.SizeOf(typeof(NativeEventHandles));
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.StructureToPtr(eventHandles, ptr, false);
            NativeFunctions.RegisterHandlers(ptr, (uint)size);
            Marshal.FreeHGlobal(ptr);
        }
Ejemplo n.º 2
0
        private static void RegisterEventHandles(ICoreEventHandler eventHandler)
        {
            eventHandles.MainLoop  = eventHandler.OnMainLoop;
            eventHandles.RunScript = eventHandler.OnRunScript;
            eventHandles.Closure   = eventHandler.OnClosure;
            eventHandles.Signal    = eventHandler.OnSignal;

            int    size = Marshal.SizeOf(typeof(NativeEventHandles));
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.StructureToPtr(eventHandles, ptr, false);
            NativeFunctions.RegisterHandlers(ptr, (uint)size);
            Marshal.FreeHGlobal(ptr);
        }