static void Main(string[] args)
        {
            WeatherDataManager manager = new WeatherDataManager();
            var forCast          = new ForeCastReport(manager);
            var statistic        = new StatisticReport(manager);
            var currentCondition = new CurrentConditionsReport(manager);

            manager.MeasurementsChange(21, 43, 78);
            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            WeatherData            weather   = new WeatherData();
            StatisticReport        report    = new StatisticReport();
            CurrentConditionReport condition = new CurrentConditionReport();
            ForeCastReport         foreCast  = new ForeCastReport();

            weather.WeatherChanged += report.WeatherChanged;
            weather.WeatherChanged += condition.WeatherChanged;
            weather.WeatherChanged += foreCast.WeatherChanged;
            weather.CurrentWeather  = new WeatherInfoArgs(11, 12, 13);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            WeatherData             weatherData             = new WeatherData();
            StatisticReport         statisticReport         = new StatisticReport();
            ForeCastReport          foreCastReport          = new ForeCastReport();
            CurrentConditionsReport currentConditionsReport = new CurrentConditionsReport();

            statisticReport.Register(weatherData);
            foreCastReport.Register(weatherData);
            currentConditionsReport.Register(weatherData);

            weatherData.MeasurementsChange(12, 32, 44);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            WeatherData data = new WeatherData();

            var a = new ForeCastReport();
            var b = new CurrentConditionsReport();

            data.MeasurementsChanged += (sender, eventArgs) => a.Update(eventArgs.Info);
            data.MeasurementsChanged += (sender, eventArgs) => b.Update(eventArgs.Info);

            data.ClearData(4, 5, 7);
            System.Console.ReadKey();
        }
        static void Main(string[] args)
        {
            WeatherData weatherData             = new WeatherData();
            var         currentConditionsReport = new CurrentConditionsReport();

            currentConditionsReport.Register(weatherData);
            weatherData.MeasurementsChange(30, 232, 12);
            var statisticRepost = new StatisticReport();
            var foreCastReport  = new ForeCastReport();

            statisticRepost.Register(weatherData);
            foreCastReport.Register(weatherData);
            weatherData.MeasurementsChange(12, 23, 567);
        }
Exemple #6
0
        public static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            var curReport      = new CurrentConditionsReport();
            var statReport     = new StatisticReport();
            var foreCastReport = new ForeCastReport();

            curReport.Subscribe(weatherData);
            statReport.Subscribe(weatherData);
            foreCastReport.Subscribe(weatherData);

            weatherData.MeasurementsChange(12, 23, 567);

            Console.ReadKey();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            WeatherInfo             weatherInfo = new WeatherInfo();
            CurrentConditionsReport report1     = new CurrentConditionsReport();

            report1.Register(weatherInfo);
            StatisticReport report2 = new StatisticReport();

            report2.Register(weatherInfo);
            ForeCastReport report3 = new ForeCastReport();

            report3.Register(weatherInfo);
            weatherInfo.NewDay(12, 23, 567);
            weatherInfo.NewDay(18, 80, 357);
            weatherInfo.NewDay(18, 96, 357);

            report1.Unregister(weatherInfo);
            report2.Unregister(weatherInfo);
            report3.Unregister(weatherInfo);
        }
        static void Main(string[] args)
        {
            WeatherDataManager dataManager = new WeatherDataManager();

            CurrentConditionReport sub1 = new CurrentConditionReport();
            ForeCastReport         sub2 = new ForeCastReport();
            StatisticReport        sub3 = new StatisticReport();;

            sub1.Register(dataManager);

            dataManager.WeatherChange(100, 200, 300);

            sub2.Register(dataManager);
            sub3.Register(dataManager);

            dataManager.WeatherChange(100, 200, 300);

            sub2.Unregister(dataManager);
            dataManager.WeatherChange(100, 200, 300);

            System.Console.ReadKey();
        }