static void Main(string[] args) { WeatherData weatherData = new WeatherData(); CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(); StatisticsDisplay statisticsDisplay = new StatisticsDisplay(); weatherData.RegisterObserver(currentConditionsDisplay); weatherData.RegisterObserver(statisticsDisplay); weatherData.MeasurementsChanged(); currentConditionsDisplay.Display(); statisticsDisplay.Display(); weatherData.MeasurementsChanged(); currentConditionsDisplay.Display(); statisticsDisplay.Display(); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("WeatherStation"); WeatherData weatherData = new WeatherData(); StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData); CurrentConditions currentConditions = new CurrentConditions(weatherData); while (true) { weatherData.MeasurementsChanged(); Thread.Sleep(1000); } }