Пример #1
0
        /// <summary>
        /// Called when a single infrared sensor pulse becomes available.
        /// </summary>
        /// <param name="pulse">The pulse.</param>
        private void OnInfraredSensorPulseAvailable(InfraredPulse pulse)
        {
            if (_isDisposed || PulseAvailable == null)
            {
                return;
            }

            var args = new InfraredSensorPulseEventArgs(pulse);

            ThreadPool.QueueUserWorkItem(a =>
            {
                PulseAvailable?.Invoke(this, a as InfraredSensorPulseEventArgs);
            },
                                         args);
        }
Пример #2
0
 public void CLearPulseAvailableeEvent()
 {
     if (PulseAvailable == null)
     {
         return;
     }
     Delegate[] dels = PulseAvailable.GetInvocationList();
     foreach (Delegate del in dels)
     {
         object delObj   = del.GetType().GetProperty("Method").GetValue(del, null);
         string funcName = (string)delObj.GetType().GetProperty("Name").GetValue(delObj, null);////方法名
         Console.WriteLine(funcName);
         PulseAvailable -= del as EventHandler <InfraredSensorPulseEventArgs>;
     }
 }
Пример #3
0
 /// <summary>
 /// Called when a single infrared sensor pulse becomes available.
 /// </summary>
 /// <param name="pulse">The pulse.</param>
 private void OnInfraredSensorPulseAvailable(InfraRedPulse pulse)
 {
     PulseAvailable?.Invoke(this, new InfraRedSensorPulseEventArgs(pulse));
 }