Exemplo n.º 1
0
        public void HandleTempratureChanged(TemperatureChangedEventArgs args)
        {
            Console.WriteLine("Current Temperature: " + args.Temperature);
            foreach (InternalRegistrationInfo registeredRequest in _registerationRequests)
            {
                if (IsThreshold(registeredRequest, args) &&
                    IsInDirection(registeredRequest, args) &&
                    !registeredRequest.IsFluctuatingAroundThreshold)
                {
                    TemperatureThresholdReachedEventArgs temperatureThresholdReachedEventArgs = new TemperatureThresholdReachedEventArgs(args.Temperature, args.ChangeDirection);
                    registeredRequest.TemperatureThresholedReachedHandler(temperatureThresholdReachedEventArgs);
                    registeredRequest.IsFluctuatingAroundThreshold = true;
                }

                if (IsOutOfWaiverMargin(registeredRequest, args))
                {
                    registeredRequest.IsFluctuatingAroundThreshold = false;
                }
            }
        }
Exemplo n.º 2
0
 public void Handler(TemperatureThresholdReachedEventArgs args)
 {
     Console.WriteLine(" ***** Oven's temperature threshold has been reached!");
     //Console.WriteLine("Current Temperature: " + args.Temperature);
 }