Exemple #1
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine("Chapter2 - Observer");
            Console.WriteLine();

            Chapter2.Good.WeatherData wd = new Good.WeatherData();
            Chapter2.Good.CurrentConditionsDisplay ccd = new Good.CurrentConditionsDisplay(wd);

            //симуляция получения новых данных
            wd.setMeasurements();
            wd.setMeasurements();
            wd.setMeasurements();
            wd.setMeasurements();
            wd.setMeasurements();

            Console.ReadKey();
        }
Exemple #2
0
 public CurrentConditionsDisplay(WeatherData wd)
 {
     _weatherData = wd;
     _weatherData.registerObserver(this);
 }