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);
        }
 public StatistcsDisplay(IObservebel observebel)
 {
     statistcsDisplay            = new StatisticsDisplay(observebel);
     statistcsDisplay.ShowEvent += updateShow;
     Closing += statistcsDisplay_Closing;
     InitializeComponent();
     ccCb.IsChecked = true;
     statistcsDisplay.observebel.Subscribe(statistcsDisplay);
 }
        private static void WeatherStation()
        {
            var weatherData       = new Weatherdata();
            var currentDisplay    = new CurrentConditionDisplay(weatherData);
            var statisticsDisplay = new StatisticsDisplay(weatherData);
            var forcastDisplay    = new ForecastDisplay(weatherData);

            weatherData.SetMeasurements(80, 65, 30.4f);
            weatherData.SetMeasurements(82, 70, 29.4f);
            weatherData.SetMeasurements(78, 80, 29.2f);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var weatherData = new WeatherData();

            var forecastDisplay          = new ForecastDisplay(weatherData);
            var statisticsDisplay        = new StatisticsDisplay(weatherData);
            var thirdPartyDisplay        = new ThirdPartyDisplay(weatherData);
            var currentConditionsDisplay = new CurrentConditionsDisplay(weatherData);

            weatherData.SetMeasurements(80.0f, 100.0f, 1100.012f);
            weatherData.SetMeasurements(90.0f, 130.0f, 1500.012f);
            weatherData.SetMeasurements(910.0f, 120.0f, 1700.012f);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionDisplay currentDisplay    = new CurrentConditionDisplay(weatherData);
            StatisticsDisplay       statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay         forecastDisplay   = new ForecastDisplay(weatherData);

            weatherData.setMeasurements(80, 65, 30.4f);
            weatherData.setMeasurements(82, 70, 29.9f);
            weatherData.setMeasurements(78, 90, 29.2f);
            Console.Read();
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay current    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statistics = new StatisticsDisplay(weatherData);

            weatherData.SetMeasurements(80f, 65f, 30.4f);
            weatherData.SetMeasurements(90f, 70f, 34.4f);
            weatherData.SetMeasurements(85f, 60f, 29.4f);

            Console.ReadKey();
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            WeatherData wd = new WeatherData();

            IDisplayElement currentConditionsDisplay = new CurrentConditionDisplay(wd);
            IDisplayElement statisticsDisplay        = new StatisticsDisplay(wd);
            IDisplayElement forecastDisplay          = new ForecastDisplay(wd);

            wd.SetMeasurements(80, 65, 30.4);
            Task.Delay(2000).Wait();
            wd.SetMeasurements(82, 70, 29.2);
            Task.Delay(2000).Wait();
            wd.SetMeasurements(78, 90, 29.2);
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            // create subject weather data to get updated from the weather station
            WeatherData weatherData = new WeatherData();

            // create three differenet display observers
            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeadIndexDisplay         heatIndexDisplay  = new HeadIndexDisplay(weatherData);

            // simulate new weather measurements
            weatherData.setMeasurements(80, 65, 30.4f);
            weatherData.setMeasurements(82, 70, 29.2f);
            weatherData.setMeasurements(78, 90, 29.2f);
        }
        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
        }
Beispiel #12
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();
        }
Beispiel #13
0
 public WeatherData()
 {
     conditionDisplay  = new ConditionDisplay();
     statisticsDisplay = new StatisticsDisplay();
     forecastDisplay   = new ForecastDisplay();
 }