Esempio n. 1
0
        static void Main(string[] args)
        {
            WeatherData WD = new WeatherData();
            CurrentConditionsDisplay CCdisplay = new CurrentConditionsDisplay(WD);
            StatisticalDisplay STDisplay = new StatisticalDisplay(WD);
            WD.setMeasurements(15.4f, 65.2f, 1002f);
            WD.setMeasurements(15.6f, 64.0f, 1004f);
            WD.setMeasurements(15.7f, 63.8f, 1004f);
            WD.setMeasurements(15.7f, 63.2f, 1004f);
            WD.setMeasurements(15.8f, 63.4f, 1003f);
            WD.setMeasurements(15.8f, 63.3f, 1004f);
            WD.setMeasurements(15.8f, 63.3f, 1004f);
            WD.setMeasurements(15.9f, 63.2f, 1005f);
            WD.setMeasurements(15.9f, 63.4f, 1005f);
            WD.setMeasurements(15.9f, 62.9f, 1005f);
            WD.setMeasurements(15.9f, 62.8f, 1005f);
            WD.setMeasurements(15.8f, 62.9f, 1006f);
            WD.setMeasurements(15.8f, 62.9f, 1005f);
            WD.setMeasurements(15.7f, 62.8f, 1005f);
            WD.setMeasurements(15.7f, 63.0f, 1006f);
            WD.setMeasurements(15.6f, 63.2f, 1005f);
            WD.setMeasurements(15.5f, 63.1f, 1005f);
            WD.setMeasurements(15.4f, 63.2f, 1005f);

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            
            Display01 display01 = new Display01();
            display01.Display();

            Display02 display02 = new Display02();
            display02.Display();

            Display03 display03 = new Display03();
            display03.Display();

            WeatherData weatherData = new WeatherData();
            weatherData.Register(display01);
            weatherData.Register(display02);
            weatherData.Register(display03);

            weatherData.measurementsChanged();
            //weatherData.Notify();

            display01.Display();
            display02.Display();
            display03.Display();

        }
Esempio n. 3
0
 static void Main(string[] args)
 {
     WeatherData weatherData = new WeatherData();
     CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
     ProjectedConditionsDisplay projectedDisplay = new ProjectedConditionsDisplay(weatherData);
     weatherData.SetMeasurements(80, 65, 30.4f);
     weatherData.SetMeasurements(82, 70, 29.2f);
     weatherData.SetMeasurements(68, 90, 45.6f);
     Console.Read();
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();
            CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);

            weatherData.setMeasurement(80, 65, 30.4f);
            weatherData.setMeasurement(82, 70, 29.2f);
            currentDisplay.RemoveObserver();
            weatherData.setMeasurement(78, 90, 29.2f);

            Console.ReadLine();
        }
Esempio n. 5
0
        static void Main(string[] args) {

            var weatherData = new WeatherData();
            new CurentConditionsDisplay(weatherData);
            new StatisticsDisplay(weatherData);

            weatherData.SetMeasurements(80, 65, 30.4f);
            weatherData.SetMeasurements(82, 70, 29.2f);
            weatherData.SetMeasurements(78, 90, 29.2f);

            Console.ReadKey();
        }
Esempio n. 6
0
        static void Input(WeatherData weatherData)
        {
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("To update weather measurements please enter the following format temperature,humidity,pressure (ex. 80,65,30.4)");
            var input = Console.ReadLine(); // Get string from user
            if (input != null)
            {
                var inputs = input.Split(',');
                weatherData.SetMeasurements(
                    Convert.ToSingle(inputs[0]),
                    Convert.ToSingle(inputs[1]),
                    Convert.ToSingle(inputs[2])
                );
            }

            Input(weatherData);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            var weatherData = new WeatherData();

            var currentDisply = new CurrentConditionDisplay(weatherData);
            var heatIndexDisplay = new HeatIndexDisplay(weatherData);
            var forecast = new ForecastDisplay(weatherData);

            weatherData.Temperature = 80;

            Console.WriteLine("------------------------------------------");

            weatherData.Humidity = 65;

            Console.WriteLine("------------------------------------------");

            weatherData.Pressure = 30.4f;

            Console.WriteLine("------------------------------------------");

            weatherData.SetMeasurements(82, 70, 29.2f);

            Input(weatherData);
        }
 public AndriodPhoneDisplay(WeatherData weatherData)
 {
     this.weatherData = weatherData;
 }
Esempio n. 9
0
        static void Main(string[] args)
        {
            var wd = new WeatherData();

            wd.measurementsChanged();
        }
 public StatisticsDisplay(WeatherData weatherData)
 {
     WeatherData = weatherData;
     weatherData.RegisterObserver(this);
 }
 public ForecastDisplay(WeatherData weatherData)
 {
     this.weatherData = weatherData;
     weatherData.RegisterObserver(this);
 }
Esempio n. 12
0
 public StatisticsDisplay(WeatherData weatherData)
 {
     weatherData.RegisterObserver(this);
     history = new List <float>();
 }
Esempio n. 13
0
 public StatisticsDisplay(WeatherData weatherData) {
     weatherData.RegisterObserver(this);
     history = new List<float>();
 }
 public LCDDisplay(WeatherData weatherData)
 {
     this.weatherData = weatherData;
 }
 public IPhonePhoneDisplay(WeatherData weatherData)
 {
     this.weatherData = weatherData;
 }
 public WeatherStation(WeatherData weatherData)
 {
     this.weatherData = weatherData;
 }
 public CurrentConditionsDisplay(WeatherData weatherData)
 {
     this.WeatherData = weatherData;
     this.WeatherData.RegisterObserver(this);
 }