internal static pxcmStatus SubscribeEventINT(IntPtr instance, OnFiredUXEventDelegate uxEventHandler, out Object proxy)
    {
        UXEventHandlerDIR uxdir = new UXEventHandlerDIR(uxEventHandler);
        pxcmStatus        sts   = PXCMTouchlessController_SubscribeEvent(instance, uxdir.uDIR);

        if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            uxdir.Dispose();
        }
        proxy = (Object)uxdir;
        return(sts);
    }
Пример #2
0
    /**
     *  @brief Register an event handler for UX Event. The event handler's will be called each time a UX event is identified.
     *  @param[in] uxEventHandler a delegete event handle.
     *  @return PXC_STATUS_NO_ERROR if the registering an event handler was successful; otherwise, return the following error:
     *  PXC_STATUS_DATA_NOT_INITIALIZED - Data failed to initialize.\n
     */
    public pxcmStatus SubscribeEvent(OnFiredUXEventDelegate uxEventHandler)
    {
        if (uxEventHandler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

        Object     proxy;
        pxcmStatus sts = SubscribeEventINT(instance, uxEventHandler, out proxy);

        if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            lock (maps.cs)
            {
                maps.uxEvents[uxEventHandler] = proxy;
            }
        }
        return(sts);
    }
Пример #3
0
    /**
     *  @brief Unsubscribe an event handler for UX events.
     *  @param[in] uxEventHandler a delegete event handle. that should be removed.
     *  @return PXC_STATUS_NO_ERROR if the unregistering the event handler was successful, an error otherwise.
     */
    public pxcmStatus UnsubscribeEvent(OnFiredUXEventDelegate uxEventHandler)
    {
        if (uxEventHandler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

        lock (maps.cs)
        {
            Object proxy;
            if (!maps.uxEvents.TryGetValue(uxEventHandler, out proxy))
            {
                return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
            }

            pxcmStatus sts = UnsubscribeEventINT(instance, proxy);
            maps.uxEvents.Remove(uxEventHandler);
            return(sts);
        }
    }
        /** 
            @brief Unsubscribe an event handler for UX events.
            @param[in] uxEventHandler a delegete event handle. that should be removed.
            @return PXC_STATUS_NO_ERROR if the unregistering the event handler was successful, an error otherwise.
        */
        public pxcmStatus UnsubscribeEvent(OnFiredUXEventDelegate uxEventHandler)
        {
            if (uxEventHandler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

            lock (maps.cs)
            {
                Object proxy;
                if (!maps.uxEvents.TryGetValue(uxEventHandler, out proxy))
                    return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

                pxcmStatus sts = UnsubscribeEventINT(instance, proxy);
                maps.uxEvents.Remove(uxEventHandler);
                return sts;
            }
        }
        /** 
            @brief Register an event handler for UX Event. The event handler's will be called each time a UX event is identified.
            @param[in] uxEventHandler a delegete event handle.
            @return PXC_STATUS_NO_ERROR if the registering an event handler was successful; otherwise, return the following error:
            PXC_STATUS_DATA_NOT_INITIALIZED - Data failed to initialize.\n        
        */
        public pxcmStatus SubscribeEvent(OnFiredUXEventDelegate uxEventHandler)
        {
            if (uxEventHandler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

            Object proxy;
            pxcmStatus sts = SubscribeEventINT(instance, uxEventHandler, out proxy);
            if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                lock (maps.cs)
                {
                    maps.uxEvents[uxEventHandler] = proxy;
                }
            }
            return sts;
        }
 public UXEventHandlerDIR(OnFiredUXEventDelegate handler)
 {
     mfunc = handler;
     gch = GCHandle.Alloc(handler);
     uDIR = PXCMTouchlessController_AllocUXEventHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 internal static pxcmStatus SubscribeEventINT(IntPtr instance, OnFiredUXEventDelegate uxEventHandler, out Object proxy)
 {
     UXEventHandlerDIR uxdir = new UXEventHandlerDIR(uxEventHandler);
     pxcmStatus sts = PXCMTouchlessController_SubscribeEvent(instance, uxdir.uDIR);
     if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
         uxdir.Dispose();
     proxy = (Object)uxdir;
     return sts;
 }
 public UXEventHandlerDIR(OnFiredUXEventDelegate handler)
 {
     mfunc = handler;
     gch   = GCHandle.Alloc(handler);
     uDIR  = PXCMTouchlessController_AllocUXEventHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }