public BathroomFanAutomation WithTrigger(IMotionDetector motionDetector) { if (motionDetector == null) throw new ArgumentNullException(nameof(motionDetector)); motionDetector.GetMotionDetectedTrigger().Triggered += TurnOn; motionDetector.GetDetectionCompletedTrigger().Triggered += StartTimeout; return this; }
public BathroomFanAutomation WithTrigger(IMotionDetector motionDetector) { if (motionDetector == null) { throw new ArgumentNullException(nameof(motionDetector)); } motionDetector.GetMotionDetectedTrigger().Triggered += TurnOn; motionDetector.GetDetectionCompletedTrigger().Triggered += StartTimeout; return(this); }
public TurnOnAndOffAutomation WithTrigger(IMotionDetector motionDetector) { if (motionDetector == null) { throw new ArgumentNullException(nameof(motionDetector)); } motionDetector.GetMotionDetectedTrigger().Attach(Trigger); motionDetector.GetDetectionCompletedTrigger().Attach(StartTimeout); motionDetector.Settings.ValueChanged += CancelTimeoutIfMotionDetectorDeactivated; return(this); }
public TurnOnAndOffAutomation WithTrigger(IMotionDetector motionDetector) { if (motionDetector == null) throw new ArgumentNullException(nameof(motionDetector)); motionDetector.GetMotionDetectedTrigger().Attach(ExecuteAutoTrigger); motionDetector.GetDetectionCompletedTrigger().Attach(StartTimeout); motionDetector.Settings.ValueChanged += (s, e) => CancelTimeoutIfMotionDetectorDeactivated(motionDetector, e); return this; }