示例#1
0
        public HandlerDIR(Handler handler)
        {
            this.handler = handler;
            gchandles    = new List <GCHandle>();
            if (handler != null)
            {
                HandlerSet handlerSet = new HandlerSet();

                if (handler.onCreateDevice != null)
                {
                    OnCreateDeviceDIRDelegate dir = new OnCreateDeviceDIRDelegate(OnCreateDevice);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onCreateDevice = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onSetupStreams != null)
                {
                    OnSetupStreamsDIRDelegate dir = new OnSetupStreamsDIRDelegate(OnSetupStreams);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onSetupStreams = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onNextDevice != null)
                {
                    OnNextDeviceDIRDelegate dir = new OnNextDeviceDIRDelegate(OnNextDevice);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onNextDevice = Marshal.GetFunctionPointerForDelegate(dir);
                }

                dirUnmanaged = PXCMCaptureManager_AllocHandlerDIR(handlerSet);
            }
        }
            public HandlerDIR(Handler handler)
            {
                this.handler = handler;
                gchandles = new List<GCHandle>();
                if (handler != null)
                {
                    HandlerSet handlerSet = new HandlerSet();

                    if (handler.onCreateDevice != null)
                    {
                        OnCreateDeviceDIRDelegate dir = new OnCreateDeviceDIRDelegate(OnCreateDevice);
                        gchandles.Add(GCHandle.Alloc(dir));
                        handlerSet.onCreateDevice = Marshal.GetFunctionPointerForDelegate(dir);
                    }
                    if (handler.onSetupStreams != null)
                    {
                        OnSetupStreamsDIRDelegate dir = new OnSetupStreamsDIRDelegate(OnSetupStreams);
                        gchandles.Add(GCHandle.Alloc(dir));
                        handlerSet.onSetupStreams = Marshal.GetFunctionPointerForDelegate(dir);
                    }
                    if (handler.onNextDevice != null)
                    {
                        OnNextDeviceDIRDelegate dir = new OnNextDeviceDIRDelegate(OnNextDevice);
                        gchandles.Add(GCHandle.Alloc(dir));
                        handlerSet.onNextDevice = Marshal.GetFunctionPointerForDelegate(dir);
                    }

                    dirUnmanaged = PXCMCaptureManager_AllocHandlerDIR(handlerSet);
                }
            }