Example #1
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();
            CurrentConditionsDisplay currentDisplay  = new CurrentConditionsDisplay(weatherData);
            CurrentHumidityDisplay   currentDisplay2 = new CurrentHumidityDisplay(weatherData);
            CurrentPressureDisplay   currentDisplay3 = new CurrentPressureDisplay(weatherData);

            weatherData.setMeasurements(20, 60, 30);
            weatherData.setMeasurements(23, 55, 20);
            weatherData.setMeasurements(25, 50, 25);
            weatherData.setMeasurements(22, 52, 30);
            weatherData.setMeasurements(20, 70, 40);
            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            WeatherData               weatherData               = new WeatherData();
            CurrentPressureDisplay    currentPressureDisplay    = new CurrentPressureDisplay(weatherData);
            CurrentHumidityDisplay    currentHumidityDisplay    = new CurrentHumidityDisplay(weatherData);
            CurrentTemperatureDisplay currentTemperatureDisplay = new CurrentTemperatureDisplay(weatherData);
            CurrentWeatherDisplay     currentWeatherDisplay     = new CurrentWeatherDisplay(weatherData);

            weatherData.SetMeasurementData(1, 2, 3);

            weatherData.RemoveObserver(currentHumidityDisplay);
            weatherData.RemoveObserver(currentTemperatureDisplay);

            weatherData.SetMeasurementData(6, 6, 6);
        }