/// <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); }
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>; } }
/// <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)); }