Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HeadFirstDesignPatterns.Ch02TheObserverPattern.WeatherStationWithEventsAndDelegates
- {
- class WeatherStationWithEventsAndDelegatesProgram
- {
- static void Main(string[] args)
- {
- CurrentConditionsDisplayWithEventsAndDelegates currentConditionsDisplay = new CurrentConditionsDisplayWithEventsAndDelegates();
- ForecastDisplayWithEventsAndDelegates forecastDisplay = new ForecastDisplayWithEventsAndDelegates();
- HeatIndexDisplayWithEventsAndDelegates heatIndexDisplay = new HeatIndexDisplayWithEventsAndDelegates();
- StatisticsDisplayWithEventsAndDelegates statisticsDisplay = new StatisticsDisplayWithEventsAndDelegates();
- WeatherDataWithEventsAndDelegates weatherObject = new WeatherDataWithEventsAndDelegates();
- weatherObject.MeasurementsChanged += currentConditionsDisplay.Update;
- weatherObject.MeasurementsChanged += forecastDisplay.Update;
- weatherObject.MeasurementsChanged += heatIndexDisplay.Update;
- weatherObject.MeasurementsChanged += statisticsDisplay.Update;
- weatherObject.NewWeather(80, 65, 30);
- weatherObject.NewWeather(82, 70, 29);
- weatherObject.NewWeather(79, 90, 29);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement