Example #1
0
    internal static pxcmStatus SubscribeGestureINT(IntPtr instance, OnFiredGestureDelegate handler, out Object proxy)
    {
        GestureHandlerDIR gdir = new GestureHandlerDIR(handler);
        pxcmStatus        sts  = PXCMHandConfiguration_SubscribeGesture(instance, gdir.uDIR);

        if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            gdir.Dispose();
        }
        proxy = (Object)gdir;
        return(sts);
    }
Example #2
0
    /**
     * @brief Register an event handler object to be called on gesture events.
     * The event handler's OnFiredGesture method will be called each time a gesture is identified.
     *
     * @param[in] gestureHandler - a pointer to the gesture handler.
     *
     * @return PXCM_STATUS_NO_ERROR - operation succeeded.
     * @return PXCM_STATUS_PARAM_UNSUPPORTED - null gesture handler.
     *
     *
     */
    public pxcmStatus SubscribeGesture(OnFiredGestureDelegate handler)
    {
        if (handler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

        Object     proxy;
        pxcmStatus sts = SubscribeGestureINT(instance, handler, out proxy);

        if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            lock (maps.cs)
            {
                maps.gesture[handler] = proxy;
            }
        }
        return(sts);
    }
Example #3
0
    /**
     *  @brief Unsubscribe a gesture event handler object.
     *  After this call no callback events will be sent to the given gestureHandler.
     *  @param[in] gestureHandler - a pointer to the event handler to unsubscribe.
     *  @return PXCM_STATUS_NO_ERROR - operation succeeded.
     *  @return PXCM_STATUS_PARAM_UNSUPPORTED - null gesture handler.
     */
    public pxcmStatus UnsubscribeGesture(OnFiredGestureDelegate handler)
    {
        if (handler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

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

            pxcmStatus sts = UnsubscribeGestureINT(instance, proxy);
            maps.gesture.Remove(handler);
            return(sts);
        }
    }
        /** 
            @brief Unsubscribe a gesture event handler object.
            After this call no callback events will be sent to the given gestureHandler.
            @param[in] gestureHandler - a pointer to the event handler to unsubscribe.
            @return PXCM_STATUS_NO_ERROR - operation succeeded. 
            @return PXCM_STATUS_PARAM_UNSUPPORTED - null gesture handler.     
        */
        public pxcmStatus UnsubscribeGesture(OnFiredGestureDelegate handler)
        {
            if (handler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

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

                pxcmStatus sts = UnsubscribeGestureINT(instance, proxy);
                maps.gesture.Remove(handler);
                return sts;
            }
        }
        /** 
        @brief Register an event handler object to be called on gesture events.
        The event handler's OnFiredGesture method will be called each time a gesture is identified.
		
        @param[in] gestureHandler - a pointer to the gesture handler.
		
        @return PXCM_STATUS_NO_ERROR - operation succeeded. 
        @return PXCM_STATUS_PARAM_UNSUPPORTED - null gesture handler.

    
    */
        public pxcmStatus SubscribeGesture(OnFiredGestureDelegate handler)
        {
            if (handler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

            Object proxy;
            pxcmStatus sts = SubscribeGestureINT(instance, handler, out proxy);
            if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                lock (maps.cs)
                {
                    maps.gesture[handler] = proxy;
                }
            }
            return sts;
        }
Example #6
0
 public GestureHandlerDIR(OnFiredGestureDelegate handler)
 {
     mfunc = handler;
     gch   = GCHandle.Alloc(handler);
     uDIR  = PXCMHandConfiguration_AllocGestureHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 public GestureHandlerDIR(OnFiredGestureDelegate handler)
 {
     mfunc = handler;
     gch = GCHandle.Alloc(handler);
     uDIR = PXCMHandConfiguration_AllocGestureHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 internal static pxcmStatus SubscribeGestureINT(IntPtr instance, OnFiredGestureDelegate handler, out Object proxy)
 {
     GestureHandlerDIR gdir = new GestureHandlerDIR(handler);
     pxcmStatus sts = PXCMHandConfiguration_SubscribeGesture(instance, gdir.uDIR);
     if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
         gdir.Dispose();
     proxy = (Object)gdir;
     return sts;
 }