int totalRecords; // Amount of times we have run a simulation
 public AverageObserver(ListBox listBox, WeatherSubject weatherSubject) : base(listBox, weatherSubject)
 {
     // When an AverageObserver is created, values will all be set to 0
     totalTemperature = 0;
     totalHumidity    = 0;
     totalPressure    = 0;
     totalRecords     = 0;
 }
 public AverageObserver(ListBox listBox, WeatherSubject weatherSubject)
     : base(listBox, weatherSubject)
 {
     // When an AverageObserver is created, values will all be set to 0
     totalTemperature = 0;
     totalHumidity = 0;
     totalPressure = 0;
     totalRecords = 0;
 }
Beispiel #3
0
        public Form1()
        {
            InitializeComponent();

            weatherSubject = new WeatherSubject();

            temperatureObserver = new TemperatureObserver(listTemperature, weatherSubject);
            averageObserver     = new AverageObserver(listAverages, weatherSubject);
            forecastObserver    = new ForecastObserver(listForecast, weatherSubject);
        }
Beispiel #4
0
        public Form1()
        {
            InitializeComponent();

            weatherSubject = new WeatherSubject();

            temperatureObserver = new TemperatureObserver(listTemperature, weatherSubject);
            averageObserver = new AverageObserver(listAverages, weatherSubject);
            forecastObserver = new ForecastObserver(listForecast, weatherSubject);
        }
        public WeatherObserver(ListBox listBox, WeatherSubject weatherSubject)
        {
            currTemperature = 0;
            currPressure = 0;
            currHumidity = 0;

            this.listBox = listBox;
            this.weatherSubject = weatherSubject;

            weatherSubject.AddObserver(this);
        }
Beispiel #6
0
        public WeatherObserver(ListBox listBox, WeatherSubject weatherSubject)
        {
            currTemperature = 0;
            currPressure    = 0;
            currHumidity    = 0;

            this.listBox        = listBox;
            this.weatherSubject = weatherSubject;

            weatherSubject.AddObserver(this);
        }
 public ForecastObserver(ListBox listBox, WeatherSubject weatherSubject) : base(listBox, weatherSubject)
 {
     previousPressure = null;    // Set to null the first time we run
 }
 public TemperatureObserver(ListBox listBox, WeatherSubject weatherSubject)
     : base(listBox, weatherSubject)
 {
 }
        int? previousPressure; // nullable int

        #endregion Fields

        #region Constructors

        public ForecastObserver(ListBox listBox, WeatherSubject weatherSubject)
            : base(listBox, weatherSubject)
        {
            previousPressure = null;    // Set to null the first time we run
        }
 public TemperatureObserver(ListBox listBox, WeatherSubject weatherSubject) : base(listBox, weatherSubject)
 {
 }