Пример #1
0
    /**
     * @brief	Adds a gesture action mapping.
     * @param [in]	gestureName				name of the gesture.
     * @param	[in]    action					The action to perform when gesture is recognized .
     * @param [in]	actionHandler	        actionHandler will be called when the action is performed
     * @return	The pxcmStatus.
     */
    public pxcmStatus AddGestureActionMapping(String gestureName, Action action, OnFiredActionDelegate actionHandler)
    {
        if (actionHandler == null)
        {
            return(PXCMTouchlessController_AddGestureActionMapping(instance, gestureName, action, IntPtr.Zero));
        }

        Object     proxy;
        pxcmStatus sts = AddGestureActionMappingINT(instance, gestureName, action, actionHandler, out proxy);

        if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            lock (maps.cs)
            {
                maps.actions.Add(proxy);
            }
        }
        return(sts);
    }
        /**
         @brief	Adds a gesture action mapping.
         @param [in]	gestureName				name of the gesture.
         @param	[in]    action					The action to perform when gesture is recognized .
         @param [in]	actionHandler	        actionHandler will be called when the action is performed	
         @return	The pxcmStatus.
         */
        public pxcmStatus AddGestureActionMapping(String gestureName, Action action, OnFiredActionDelegate actionHandler)
        {
            if (actionHandler == null)
                return PXCMTouchlessController_AddGestureActionMapping(instance, gestureName, action, IntPtr.Zero);

            Object proxy;
            pxcmStatus sts = AddGestureActionMappingINT(instance, gestureName, action, actionHandler, out proxy);
            if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                lock (maps.cs)
                {
                    maps.actions.Add(proxy);
                }
            }
            return sts;
        }
 internal static pxcmStatus AddGestureActionMappingINT(IntPtr instance, String gestureName, Action action, OnFiredActionDelegate actionHandler, out Object proxy)
 {
     ActionHandlerDIR adir = new ActionHandlerDIR(actionHandler);
     pxcmStatus sts = PXCMTouchlessController_AddGestureActionMapping(instance, gestureName, action, adir.uDIR);
     if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
     {
         adir.Dispose();
     }
     proxy = (Object)adir;
     return sts;
 }
 public ActionHandlerDIR(OnFiredActionDelegate handler)
 {
     mfunc = handler;
     gch = GCHandle.Alloc(handler);
     uDIR = PXCMTouchlessController_AllocActionHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
    internal static pxcmStatus AddGestureActionMappingINT(IntPtr instance, String gestureName, Action action, OnFiredActionDelegate actionHandler, out Object proxy)
    {
        ActionHandlerDIR adir = new ActionHandlerDIR(actionHandler);
        pxcmStatus       sts  = PXCMTouchlessController_AddGestureActionMapping(instance, gestureName, action, adir.uDIR);

        if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            adir.Dispose();
        }
        proxy = (Object)adir;
        return(sts);
    }
 public ActionHandlerDIR(OnFiredActionDelegate handler)
 {
     mfunc = handler;
     gch   = GCHandle.Alloc(handler);
     uDIR  = PXCMTouchlessController_AllocActionHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }