public BathroomFanAutomation WithTrigger(IMotionDetector motionDetector)
        {
            if (motionDetector == null) throw new ArgumentNullException(nameof(motionDetector));

            motionDetector.GetMotionDetectedTrigger().Triggered += TurnOn;
            motionDetector.GetDetectionCompletedTrigger().Triggered += StartTimeout;

            return this;
        }
Пример #2
0
        public BathroomFanAutomation WithTrigger(IMotionDetector motionDetector)
        {
            if (motionDetector == null)
            {
                throw new ArgumentNullException(nameof(motionDetector));
            }

            motionDetector.GetMotionDetectedTrigger().Triggered     += TurnOn;
            motionDetector.GetDetectionCompletedTrigger().Triggered += StartTimeout;

            return(this);
        }
Пример #3
0
        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;
        }