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

            currentConditionsDisplay1.Subscribe(weatherData);
            currentConditionsDisplay2.Subscribe(weatherData);
            weatherData.UpdateMeasurements(new WeatherInformation()
            {
                Temperature = 80, Humidity = 30, Pressure = 1024
            });
            currentConditionsDisplay1.Unsuscribe();
            weatherData.UpdateMeasurements(new WeatherInformation()
            {
                Temperature = 80, Humidity = 30, Pressure = 1024
            });
            weatherData.EndTransmision();
            Console.Read();
        }