Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            weather   = new WeatherData();
            statistic = new StatisticReport();
            current   = new CurrentConditionsReport();

            statistic.Register(weather);
            current.Register(weather);
            GetReports();
        }
        static void Main(string[] args)
        {
            WeatherData             waetherStation   = new WeatherData();
            CurrentConditionsReport conditionsReport = new CurrentConditionsReport();
            StatisticReport         statisticReport  = new StatisticReport();

            conditionsReport.Register(waetherStation);
            statisticReport.Register(waetherStation);
            statisticReport.Unregister(waetherStation);

            waetherStation.StartNotify();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            var weatherStation = new WeatherData();
            var currentInfo    = new CurrentConditionsReport();
            var statisticInfo  = new StatisticReport();

            currentInfo.Register(weatherStation);
            statisticInfo.Register(weatherStation);

            while (true)
            {
                Thread.Sleep(2000);
                weatherStation.GenerateWeather();
                Console.WriteLine("Current info: " + currentInfo);
                Console.WriteLine("Statistic: " + statisticInfo);
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Create Current Conditions Report");
            CurrentConditionsReport conditionsReport = new CurrentConditionsReport();

            Console.WriteLine("Create Statistic Report");
            StatisticReport statisticReport = new StatisticReport();

            Console.WriteLine("Create observable object: Weather data");
            WeatherData weatherData = new WeatherData(50, 2);

            Console.WriteLine("Register observers Current Conditions Report and Statistic Report");

            conditionsReport.Register(weatherData);
            statisticReport.Register(weatherData);

            weatherData.StartMeasure();
            Console.ReadLine();
        }