Esempio n. 1
0
        static void Main(string[] args)
        {
            var weatherData = new WeatherData();

            var currentConditionsReport = new CurrentConditionsReport();
            var statisticReport         = new StatisticReport();
            var foreCastReport          = new ForeCastReport();

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

            weatherData.MeasurementsChange(12, 23, 567);

            statisticReport.UnRegister(weatherData);

            weatherData.MeasurementsChange(1000, 2003, 9807);

            currentConditionsReport.UnRegister(weatherData);
            foreCastReport.UnRegister(weatherData);

            weatherData.MeasurementsChange(0, 0, 0);

            System.Console.ReadKey();
        }
Esempio n. 2
0
        private void statisticReportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StatisticReport sr = StatisticReport.GetInstance();

            sr.MdiParent = this;
            sr.Show();
        }
        static void Main(string[] args)
        {
            WeatherData     weatherData             = new WeatherData();
            var             currentConditionsReport = new CurrentConditionsReport(weatherData);
            StatisticReport statisticReport         = new StatisticReport(weatherData);

            weatherData.SimulateNewMeasurmentData(8, 670, 60);
            weatherData.SimulateNewMeasurmentData(12, 650, 65);
            weatherData.SimulateNewMeasurmentData(10, 600, 68.5);
        }
        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();
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            var currentConditionReport = new CurrentConditionReport(weatherData);
            var statisticReport        = new StatisticReport(weatherData);

            weatherData.SetMeasurements(14, 67.7, 45);
            weatherData.SetMeasurements(15, 56.4, 34.2);
            weatherData.SetMeasurements(18, 60.3, 64);

            statisticReport.Display();
        }
Esempio n. 7
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);
        }
        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);
        }
Esempio n. 9
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();
        }
        static void Main(string[] args)
        {
            var weatherData   = new WeatherData();
            var stats         = new StatisticReport();
            var currentReport = new CurrentConditionsReport();

            weatherData.WeatherChanged += currentReport.Update;
            weatherData.WeatherChanged += stats.Update;
            weatherData.StartGettingMeasurements(1000);
            System.Console.ReadLine();
            weatherData.StopGettingMeasurements();
            System.Console.ReadLine();
            weatherData.WeatherChanged -= currentReport.Update;
            weatherData.StartGettingMeasurements(1000);
            System.Console.ReadLine();
            weatherData.StopGettingMeasurements();
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            var weatherData   = new WeatherData();
            var stats         = new StatisticReport();
            var currentReport = new CurrentConditionsReport();

            weatherData.Register(currentReport);
            weatherData.Register(stats);
            weatherData.StartGettingMeasurements(1000);
            System.Console.ReadLine();
            weatherData.StopGettingMeasurements();
            System.Console.ReadLine();
            weatherData.Unregister(currentReport);
            weatherData.StartGettingMeasurements(1000);
            System.Console.ReadLine();
            weatherData.StopGettingMeasurements();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            var weatherTemperature      = new WeatherTemperature(20);
            var weatherHumidity         = new WeatherHumidity(10);
            var weatherPressure         = new WeatherPressure(15);
            var weatherData             = new WeatherData(weatherTemperature, weatherHumidity, weatherPressure);
            var currentConditionsReport = new CurrentConditionsReport();
            var statisticReport         = new StatisticReport();
            var weatherStation          = new WeatherStation(weatherData, currentConditionsReport, statisticReport);

            weatherData.SetWeatherData(weatherTemperature, weatherHumidity, weatherPressure);
            weatherTemperature.SetTemperature(35);
            weatherData.SetWeatherData(weatherTemperature, weatherHumidity, weatherPressure);
            weatherHumidity.SetHumidity(25);
            weatherData.SetWeatherData(weatherTemperature, weatherHumidity, weatherPressure);
            weatherPressure.SetPressure(100);
            weatherData.SetWeatherData(weatherTemperature, weatherHumidity, weatherPressure);
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
        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();
        }
Esempio n. 15
0
 public bool StatisticReport(out StatisticReport report)
 {
     return FreeImage.StatisticReport(this.Dib, out report);
 }