Exemplo n.º 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 DocumentWatcher(HandlerSet handlerSet, IServiceProvider serviceProvider)
        {
            hs = handlerSet;
            dt = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(SVsRunningDocumentTable));

            dt.AdviseRunningDocTableEvents(this, out rdtCookie);
        }
Exemplo n.º 3
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);
                }
            }
Exemplo n.º 4
0
        public Token Bind(Event e, Handler handler)
        {
            rwlock.EnterWriteLock();
            try
            {
                HandlerSet handlers;
                if (!handlerMap.TryGetValue(e, out handlers))
                {
                    handlers = new HandlerSet();
                    handlerMap.Add(e, handlers);
                }

                var token = new Token(e, handler);
                if (handlers.Add(handler))
                {
                    filter.Add(e.GetTypeId(), e.GetFingerprint());

                    var eventSink = handler.Action.Target as EventSink;
                    if (!ReferenceEquals(eventSink, null))
                    {
                        eventSink.AddBinding(token);
                    }
                }
                return(token);
            }
            finally
            {
                rwlock.ExitWriteLock();
            }
        }
Exemplo n.º 5
0
            public void Add(object o, string label, Action reset, Action restore)
            {
                ResetHandlerKey hkey = new ResetHandlerKey()
                {
                    Object = o, Label = label
                };

                Handlers[hkey] = new HandlerSet {
                    Reset = reset, Restore = restore
                };
            }
Exemplo n.º 6
0
        internal void InitHandlerDIR()
        {
            HandlerSet handlerSet = new HandlerSet();

            gchandles = new List <GCHandle>();

            if (onDeviceListChanged != null)
            {
                gchandles.Add(GCHandle.Alloc(onDeviceListChanged));
                handlerSet.onDeviceListChanged = Marshal.GetFunctionPointerForDelegate(onDeviceListChanged);
            }
            dirUnmanaged = PXCMCapture_AllocHandlerDIR(handlerSet);
        }
Exemplo n.º 7
0
            public HandlerSet(HandlerSet parent, params Handler[] handlers)
            {
                foreach (var handler in parent)
                {
                    Add(handler.Key, handler.Value);
                }

                if (handlers == null)
                {
                    return;
                }

                foreach (var handler in handlers)
                {
                    this[handler.Type] = handler;
                }
            }
Exemplo n.º 8
0
        public HandlerDIR(PXCMSenseManager sm, Handler handler)
        {
            this.sm      = sm;
            this.handler = handler;
            HandlerSet handlerSet = new HandlerSet();

            gchandles = new List <GCHandle>();

            if (handler.onConnect != null)
            {
                OnConnectDIRDelegate dir = new OnConnectDIRDelegate(OnConnect);
                gchandles.Add(GCHandle.Alloc(dir));
                handlerSet.onConnect = Marshal.GetFunctionPointerForDelegate(dir);
            }
            if (handler.onModuleSetProfile != null)
            {
                OnModuleSetProfileDIRDelegate dir = new OnModuleSetProfileDIRDelegate(OnModuleSetProfile);
                gchandles.Add(GCHandle.Alloc(dir));
                handlerSet.onModuleSetProfile = Marshal.GetFunctionPointerForDelegate(dir);
            }
            if (handler.onModuleProcessedFrame != null)
            {
                OnModuleProcessedFrameDIRDelegate dir = new OnModuleProcessedFrameDIRDelegate(OnModuleProcessedFrame);
                gchandles.Add(GCHandle.Alloc(dir));
                handlerSet.onModuleProcessedFrame = Marshal.GetFunctionPointerForDelegate(dir);
            }
            if (handler.onNewSample != null)
            {
                OnNewSampleDIRDelegate dir = new OnNewSampleDIRDelegate(OnNewSample);
                gchandles.Add(GCHandle.Alloc(dir));
                handlerSet.onNewSample = Marshal.GetFunctionPointerForDelegate(dir);
            }
            if (handler.onStatus != null)
            {
                OnStatusDIRDelegate dir = new OnStatusDIRDelegate(OnStatus);
                gchandles.Add(GCHandle.Alloc(dir));
                handlerSet.onStatus = Marshal.GetFunctionPointerForDelegate(dir);
            }

            dirUnmanaged = PXCMSenseManager_AllocHandlerDIR(handlerSet);
        }
 public HandlerDIR(Handler handler)
 {
     this.handler = handler;
     gchandles    = new List <GCHandle>();
     if (handler != null)
     {
         HandlerSet handlerSet = new HandlerSet();
         if (handler.onRecognition != null)
         {
             OnRecognitionDIRDelegate dir = new OnRecognitionDIRDelegate(OnRecognition);
             gchandles.Add(GCHandle.Alloc(dir));
             handlerSet.onRecognition = Marshal.GetFunctionPointerForDelegate(dir);
         }
         if (handler.onAlert != null)
         {
             OnAlertDIRDelegate dir = new OnAlertDIRDelegate(OnAlert);
             gchandles.Add(GCHandle.Alloc(dir));
             handlerSet.onAlert = Marshal.GetFunctionPointerForDelegate(dir);
         }
         dirUnmanaged = PXCMSpeechRecognition_AllocHandlerDIR(handlerSet);
     }
 }
Exemplo n.º 10
0
 public HandlerDIR(Handler handler)
 {
     this.handler = handler;
     gchandles = new List<GCHandle>();
     if (handler != null)
     {
         HandlerSet handlerSet = new HandlerSet();
         if (handler.onRecognition != null)
         {
             OnRecognitionDIRDelegate dir = new OnRecognitionDIRDelegate(OnRecognition);
             gchandles.Add(GCHandle.Alloc(dir));
             handlerSet.onRecognition = Marshal.GetFunctionPointerForDelegate(dir);
         }
         if (handler.onAlert != null)
         {
             OnAlertDIRDelegate dir = new OnAlertDIRDelegate(OnAlert);
             gchandles.Add(GCHandle.Alloc(dir));
             handlerSet.onAlert = Marshal.GetFunctionPointerForDelegate(dir);
         }
         dirUnmanaged = PXCMSpeechRecognition_AllocHandlerDIR(handlerSet);
     }
 }
Exemplo n.º 11
0
 internal static extern IntPtr PXCMSpeechRecognition_AllocHandlerDIR(HandlerSet hs);
Exemplo n.º 12
0
			public void Add(object o, string label, Action reset, Action restore)
			{
				ResetHandlerKey hkey = new ResetHandlerKey() { Object = o, Label = label };
				Handlers[hkey] = new HandlerSet { Reset = reset, Restore = restore };
			}
Exemplo n.º 13
0
 private static extern IntPtr PXCMCapture_AllocHandlerDIR(HandlerSet hs);
Exemplo n.º 14
0
 internal static extern IntPtr PXCMCaptureManager_AllocHandlerDIR(HandlerSet hs);
Exemplo n.º 15
0
 internal static extern IntPtr PXCMSpeechRecognition_AllocHandlerDIR(HandlerSet hs);
Exemplo n.º 16
0
            internal void InitHandlerDIR()
            {
                HandlerSet handlerSet = new HandlerSet();
                gchandles = new List<GCHandle>();

                if (onDeviceListChanged != null)
                {
                    gchandles.Add(GCHandle.Alloc(onDeviceListChanged));
                    handlerSet.onDeviceListChanged = Marshal.GetFunctionPointerForDelegate(onDeviceListChanged);
                }
                dirUnmanaged = PXCMCapture_AllocHandlerDIR(handlerSet);
            }
Exemplo n.º 17
0
 private static extern IntPtr PXCMCapture_AllocHandlerDIR(HandlerSet hs);
Exemplo n.º 18
0
            public HandlerDIR(PXCMSenseManager sm, Handler handler)
            {
                this.sm = sm;
                this.handler = handler;
                HandlerSet handlerSet = new HandlerSet();
                gchandles = new List<GCHandle>();

                if (handler.onConnect != null)
                {
                    OnConnectDIRDelegate dir = new OnConnectDIRDelegate(OnConnect);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onConnect = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onModuleSetProfile != null)
                {
                    OnModuleSetProfileDIRDelegate dir = new OnModuleSetProfileDIRDelegate(OnModuleSetProfile);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onModuleSetProfile = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onModuleProcessedFrame != null)
                {
                    OnModuleProcessedFrameDIRDelegate dir = new OnModuleProcessedFrameDIRDelegate(OnModuleProcessedFrame);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onModuleProcessedFrame = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onNewSample != null)
                {
                    OnNewSampleDIRDelegate dir = new OnNewSampleDIRDelegate(OnNewSample);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onNewSample = Marshal.GetFunctionPointerForDelegate(dir);
                }
                if (handler.onStatus != null)
                {
                    OnStatusDIRDelegate dir = new OnStatusDIRDelegate(OnStatus);
                    gchandles.Add(GCHandle.Alloc(dir));
                    handlerSet.onStatus = Marshal.GetFunctionPointerForDelegate(dir);
                }

                dirUnmanaged = PXCMSenseManager_AllocHandlerDIR(handlerSet);
            }
Exemplo n.º 19
0
 internal static extern IntPtr PXCMSenseManager_AllocHandlerDIR(HandlerSet hs);