Beispiel #1
0
        static void Main(string[] args)
        {
            var weatherManager          = new WeatherManager();
            var currentConditionsReport = new CurrentConditionsReport(weatherManager);
            var statisticReport         = new StatisticReport();

            statisticReport.Register(weatherManager);

            weatherManager.NewEvent();

            Console.ReadKey();
        }
Beispiel #2
0
        public static void Main()
        {
            var weatherStation    = new WeatherStation();
            var conditionReporter = new CurrentConditionsReport();
            var statisticReporter = new StatisticReport();

            weatherStation.WeatherChanged += conditionReporter.Report;
            weatherStation.WeatherChanged += statisticReporter.Report;

            weatherStation.EmulateWeatherChange();
            weatherStation.EmulateWeatherChange();
            weatherStation.EmulateWeatherChange();

            weatherStation.WeatherChanged -= statisticReporter.Report;

            weatherStation.EmulateWeatherChange();
            weatherStation.EmulateWeatherChange();
        }