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(); }
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(); }