Ejemplo n.º 1
0
 public WeatherObserver(int currentTemp, int currentHumidity, int currentPressure, ListBox displayBox, MonitorSubject subject)
 {
     this.currentTemp     = currentTemp;
     this.currentHumidity = currentHumidity;
     this.currentPressure = currentPressure;
     avgTempTotal         = currentTemp;
     avgHumidityTotal     = currentHumidity;
     avgPressureTotal     = currentPressure;
     updateCount          = 0;
     this.displayBox      = displayBox;
     this.subject         = subject;
     subject.AddObserver(this);
 }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            txtBTemp.Text     = "32";
            txtBHumidity.Text = "90";
            txtBPressure.Text = "560";
            //subject = new MonitorSubject(int.Parse(txtBTemp.Text), int.Parse(txtBHumidity.Text), int.Parse(txtBPressure.Text));
            subject = new MonitorSubject(0, 0, 0);
            WeatherObserver obCurrentTemp    = new CurrentTemperature(Convert.ToInt16(txtBTemp.Text), Convert.ToInt16(txtBHumidity.Text), Convert.ToInt16(txtBPressure.Text), richTextBoxTemp, subject);
            WeatherObserver obAverageReading = new AverageReadings(Convert.ToInt16(txtBTemp.Text), Convert.ToInt16(txtBHumidity.Text), Convert.ToInt16(txtBPressure.Text), richTextBoxAverage, subject);
            WeatherObserver obForcast        = new Forcast(Convert.ToInt16(txtBTemp.Text), Convert.ToInt16(txtBHumidity.Text), Convert.ToInt16(txtBPressure.Text), richTextBoxForcast, subject);

            subject.AddObserver(obCurrentTemp);
            subject.AddObserver(obAverageReading);
            subject.AddObserver(obForcast);
        }
Ejemplo n.º 3
0
 public Forcast(int currentTemp, int currentHumidity, int currentPressure, RichTextBox displayBox, MonitorSubject subject) : base(currentTemp, currentHumidity, currentPressure, displayBox, subject)
 {
 }
Ejemplo n.º 4
0
 public AverageReadings(int currentTemp, int currentHumidity, int currentPressure, ListBox displayBox, MonitorSubject subject) : base(currentTemp, currentHumidity, currentPressure, displayBox, subject)
 {
 }
Ejemplo n.º 5
0
 public CurrentTemperature(int currentTemp, int currentHumidity, int currentPressure, ListBox displayBox, MonitorSubject subject) : base(currentTemp, currentHumidity, currentPressure, displayBox, subject)
 {
 }