static void Main(string[] args)
        {
            WeatherForcaster weatherForcaster = new WeatherForcaster();

            CurrentConditionsDisplay currentDisplay   = new CurrentConditionsDisplay(weatherForcaster);
            StatisticDisplay         statisticDisplay = new StatisticDisplay(weatherForcaster);
            ForcastDisplay           forcastDisplay   = new ForcastDisplay(weatherForcaster);

            weatherForcaster.SetWeatherMeasurement(new WeatherObject(80, 65, 30.4f));
            weatherForcaster.SetWeatherMeasurement(new WeatherObject(82, 70, 29.2f));
            weatherForcaster.SetWeatherMeasurement(new WeatherObject(78, 90, 29.2f));

            currentDisplay.Dispose();
            statisticDisplay.Dispose();

            HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherForcaster);

            weatherForcaster.SetWeatherMeasurement(new WeatherObject(80, 65, 30.4f));
            weatherForcaster.SetWeatherMeasurement(new WeatherObject(82, 70, 29.2f));
            weatherForcaster.SetWeatherMeasurement(new WeatherObject(78, 90, 29.2f));

            Console.Read();
        }
Esempio n. 2
0
 public StatisticDisplay(WeatherForcaster weatherForcaster)
 {
     this.weatherForcaster = weatherForcaster;
     weatherForcaster.WeatherObjectChanged += new WeatherForcaster.WeatherObjectChangedEventHandler(Update);
 }
Esempio n. 3
0
 public CurrentConditionsDisplay(WeatherForcaster weatherForcaster)
 {
     this.weatherForcaster = weatherForcaster;
     weatherForcaster.WeatherObjectChanged += new WeatherForcaster.WeatherObjectChangedEventHandler(Update);
 }