コード例 #1
0
        static void Main(string[] args)
        {
            // create the subject and observers
            WeatherData weatherData = new WeatherData();

            CurrentConditions conditions = new CurrentConditions(weatherData);
            Statistics        statistics = new Statistics(weatherData);
            Forecast          forecast   = new Forecast(weatherData);

            // create the readings
            WeatherMeasurements readings = new WeatherMeasurements();

            readings.humidity    = 40.5F;
            readings.pressure    = 20F;
            readings.temperature = 72F;

            // update the readings - everyone should print
            weatherData.UpdateReadings(readings);

            // update
            readings.pressure = 10F;
            weatherData.UpdateReadings(readings);

            // update
            readings.humidity    = 100;
            readings.temperature = 212.75F;
            readings.pressure    = 950;
            weatherData.UpdateReadings(readings);

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: bgokoglu/HFPatterns
        static void Main(string[] args)
        {
            // create the subject and observers
            WeatherData weatherData = new WeatherData();

            CurrentConditions conditions = new CurrentConditions(weatherData);
            Statistics statistics = new Statistics(weatherData);
            Forecast forecast = new Forecast(weatherData);

            // create the readings
            WeatherMeasurements readings = new WeatherMeasurements();
            readings.humidity = 40.5F;
            readings.pressure = 20F;
            readings.temperature = 72F;

            // update the readings - everyone should print
            weatherData.UpdateReadings(readings);

            // update
            readings.pressure = 10F;
            weatherData.UpdateReadings(readings);

            // update
            readings.humidity = 100;
            readings.temperature = 212.75F;
            readings.pressure = 950;
            weatherData.UpdateReadings(readings);

            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            // create the subject and observers
            WeatherData weatherData = new WeatherData();

            weatherData.Humidity         = 40.5F;
            weatherData.Pressure         = 20F;
            weatherData.Temperature      = 72F;
            weatherData.PropertyChanged += degis;
            void degis(object sender, PropertyChangedEventArgs e)
            {
                Console.WriteLine("sıcaklık: " + weatherData.Temperature + "basınç: " + weatherData.Pressure + "nem: " + weatherData.Humidity);
            }

            CurrentConditions conditions = new CurrentConditions(weatherData);
            //Statistics statistics = new Statistics(weatherData);
            Forecast forecast = new Forecast(weatherData);

            // create the readings
            WeatherMeasurements readings = new WeatherMeasurements();

            readings.Humidity    = 40.5F;
            readings.Pressure    = 20F;
            readings.Temperature = 72F;

            // update the readings - everyone should print
            weatherData.UpdateReadings(readings);

            // update
            //readings.Pressure = 10F;
            //weatherData.UpdateReadings(readings);

            // update
            //readings.Humidity = 100;
            //readings.Temperature = 212.75F;
            //readings.Pressure = 950;
            //weatherData.UpdateReadings(readings);*/
            Console.ReadLine();
        }
コード例 #4
0
 public void Update(WeatherMeasurements newReadings)
 {
     this.readings = newReadings;
     Display();
 }
コード例 #5
0
 public void UpdateReadings(WeatherMeasurements newReadings)
 {
     this.readings = newReadings;
     HasChanged();
 }
コード例 #6
0
ファイル: WeatherData.cs プロジェクト: bgokoglu/HFPatterns
 public void UpdateReadings(WeatherMeasurements newReadings)
 {
     this.readings = newReadings;
     HasChanged();
 }