示例#1
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);
        }
        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);

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

            readings.Temperature = 80f;
            readings.Humidity    = 65f;
            readings.Pressure    = 30.4f;

            weatherData.Mesurements(readings);

            readings.Temperature = 82f;
            readings.Humidity    = 70f;
            readings.Pressure    = 29.2f;
            weatherData.Mesurements(readings);

            readings.Temperature = 78f;
            readings.Humidity    = 90f;
            weatherData.Mesurements(readings);
        }
示例#3
0
        static void Main(string[] args)
        {
            WeatherStation           weatherStation           = new WeatherStation();
            CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(weatherStation);
            StatisticsDisplay        statisticsDisplay        = new StatisticsDisplay(weatherStation);
            HeatIndexDisplay         heatIndexDisplay         = new HeatIndexDisplay(weatherStation);

            weatherStation.setMeasurements(80, 65, 30.4);
            weatherStation.setMeasurements(82, 70, 29.2);
            weatherStation.setMeasurements(78, 90, 29.2);
        }
示例#4
0
        static void Main(string[] args)
        {
            WeatherData      weatherData      = new WeatherData();
            ForecastDisplay  forecastDisplay  = new ForecastDisplay(weatherData);
            HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);

            //weatherData.registerObserver(forecastDisplay);
            //weatherData.registerObserver(heatIndexDisplay);


            weatherData.setMeasurements(80, 65, 30.4f);
            weatherData.setMeasurements(82, 70, 29.2f);
            weatherData.setMeasurements(78, 90, 29.2f);
        }
示例#5
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();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("*** Observer ***");

            WeatherData weatherData = new WeatherData();

            CurrentConditionalDisplay conditionalDisplay = new CurrentConditionalDisplay(weatherData);
            StatisticsDisplay         statisticsDisplay  = new StatisticsDisplay(weatherData);
            ForecastDisplay           forecastDisplay    = new ForecastDisplay(weatherData);
            HeatIndexDisplay          heatIndexDisplay   = new HeatIndexDisplay(weatherData);

            weatherData.SetMeasurements(26, 65, 760);
            weatherData.SetMeasurements(30, 70, 750);
            weatherData.SetMeasurements(0, 90, 790);

            #if (!vscode) // Add this for run from VS in order to console window will keep open
            Console.WriteLine("Press Enter for exit");
            Console.ReadLine();
            #endif
        }
示例#7
0
        static void Main(string[] args)
        {
            //Create the weatherData object
            WeatherData weatherData = new WeatherData();

            //Create the 3 displays and pass them the weatherData object
            CurrentConditionDisplay currentDisplay    = new CurrentConditionDisplay(weatherData);
            StatisticsDisplay       statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay         forecastDisplay   = new ForecastDisplay(weatherData);
            //Add the new heat index display
            HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);

            //Input data (from fictional weather station)
            weatherData.SetMeasurements(80, 65, 30.4f);
            weatherData.SetMeasurements(82, 70, 29.2f);
            weatherData.SetMeasurements(78, 90, 29.2f);

            //Show display output in console
            Console.ReadLine();
        }
示例#8
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionDisplay currentdDisplay = new CurrentConditionDisplay(weatherData);

            /*
             * Se deberia poner el StatisticDisplay y  el ForecastDisplay
             *
             * StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
             * ForecastDisplay forecastDisplay = ForecastDisplay(weatherData);
             *
             */

            HeatIndexDisplay heatDisplay = new HeatIndexDisplay(weatherData);

            weatherData.setMeasurements(80, 65, 30.4f);
            weatherData.setMeasurements(82, 70, 29.2f);
            weatherData.setMeasurements(78, 90, 29.2f);
        }
示例#9
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);
        }