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

            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay  = new HeatIndexDisplay(weatherData);

            Measurements measurements = new Measurements
            {
                humidity    = 65F,
                pressure    = 30.4F,
                temperature = 80F
            };

            weatherData.SetMeasurements(measurements);

            measurements.humidity    = 70F;
            measurements.pressure    = 29.2F;
            measurements.temperature = 82F;
            weatherData.SetMeasurements(measurements);

            measurements.humidity    = 90F;
            measurements.pressure    = 29.2F;
            measurements.temperature = 78F;
            weatherData.SetMeasurements(measurements);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay currentConditions = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);

            Console.ReadLine();
        }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     WeatherData weatherData = new WeatherData();
     CurrentConditionsDisplay ccd = new CurrentConditionsDisplay(weatherData);
     ForecastDisplay fd = new ForecastDisplay(weatherData);
     StatisticsDisplay sd = new StatisticsDisplay(weatherData);
     ThirdPartyDisplay tpd = new ThirdPartyDisplay(weatherData);
     weatherData.SetMeasurements(15, 75, 30);
     weatherData.SetMeasurements(18, 80, 31.2);
     weatherData.SetMeasurements(18, 75, 32.8);
     Console.ReadKey(true);
 }
Ejemplo n.º 4
0
        static void Main()
        {
            WeatherData wd = new WeatherData();
            CurrentConditionsDisplay ccd = new CurrentConditionsDisplay(wd);
            StatisticsDisplay sd = new StatisticsDisplay(wd);
            HeatIndexDisplay hid = new HeatIndexDisplay(wd);

            wd.SetMeasurements(78, 90, 29.2f);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay  = new HeatIndexDisplay(weatherData);

            weatherData.setMeasurements(80, 65, 30.4f);
            weatherData.setMeasurements(82, 70, 29.2f);
            weatherData.setMeasurements(78, 90, 29.2f);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionalsDisplay currenConditionalsDisplay = new CurrentConditionalsDisplay(weatherData);
            StatisticsDisplay          statisticsDisplay         = new StatisticsDisplay(weatherData);

            weatherData.SetMeasurments(30.0f, 5.0f, 200.0f);
            weatherData.SetMeasurments(10.0f, 6.0f, 300.0f);
            weatherData.SetMeasurments(-20.0f, 2.0f, 100.0f);

            Console.ReadLine();
        }
Ejemplo n.º 7
0
        public void Main()
        {
            WeatherData weatherData = new WeatherData();
            CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay        = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay          = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay         = new HeatIndexDisplay(weatherData);

            weatherData.SetMeasurementsChanged(80, 65, 30.4f);
            Console.WriteLine("===========================================");
            weatherData.SetMeasurementsChanged(82, 70, 29.2f);
            Console.WriteLine("===========================================");
            weatherData.SetMeasurementsChanged(78, 90, 29.2f);
        }
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            //Инициализация наблюдателей
            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);

            //Обновление данных
            weatherData.setMeasurements(80, 45, 34.5f);
            //Удаление одного из наблюдателей
            statisticsDisplay.remove();
            weatherData.setMeasurements(45, 34, 37.6f);
            weatherData.setMeasurements(49, 45, 38.5f);
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            var meteostation            = new Meteostation();
            var weatherData             = new WeatherData(meteostation);
            var currentConditionDisplay = new CurrentConditionDisplay(weatherData);

            meteostation.mesurementsChanged();
            var forecastDisplay = new ForecastDisplay(weatherData);

            meteostation.mesurementsChanged();
            currentConditionDisplay.Unsubscribe();
            meteostation.mesurementsChanged();
            var statisticsDisplay = new StatisticsDisplay(weatherData);

            currentConditionDisplay.Subscribe(weatherData);
            meteostation.mesurementsChanged();
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Weather Station");
            Console.WriteLine();

            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay  = new HeatIndexDisplay(weatherData);

            weatherData.SetMeasurements(80, 65, 30.4f);
            Console.WriteLine();
            weatherData.SetMeasurements(87, 70, 29.2f);
            Console.WriteLine();
            weatherData.SetMeasurements(78, 90, 29.2f);
            Console.WriteLine();
            weatherData.SetMeasurements(65, 75, 29.2f);
            Console.WriteLine();

            int   temp, hum;
            float press;

            Console.Write("What is the current Temperature? T: ");
            temp = Int32.Parse(Console.ReadLine());
            Console.Write("What is the current Humidity? H: ");
            hum = Int32.Parse(Console.ReadLine());
            Console.Write("What is the current Pressure? P: ");
            press = float.Parse(Console.ReadLine());
            Console.WriteLine();

            weatherData.SetMeasurements(temp, hum, press);
            Console.WriteLine();

            Console.ReadKey();
        }