Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          patterns/observer/weather-info-events/client.cs - Application of the two different Watchers.Lecture 6 - slide 20 : 20
Program 1

using Templates.Observer;

class Client {

  public static void Main(){

     WeatherCenter subj = new WeatherCenter(25.0F, 0.0F, 1020.0F);
              o1 = new TemperatureWatcher(subj, 25.0F, "w1"),
              o2 = new TemperatureWatcher(subj, 25.0F, "w2");
              o3 = new RainWatcher(subj, 0.0F, "w3");

     subj.AddNotifier(o1.TemperatureAlarm);  // Adding instance methods
     subj.AddNotifier(o2.TemperatureAlarm);  // to an event in
     subj.AddNotifier(o3.RainAlarm);         // the subject

     subj.WeatherUpdate(23.0F, 0.0F, 1020.0F);
     subj.WeatherUpdate(23.0F, 2.0F, 1020.0F);
     subj.WeatherUpdate(23.0F, 0.0F, 1020.0F);
     subj.WeatherUpdate(24.0F, 0.3F,  920.0F);
     subj.WeatherUpdate(21.0F, 3.7F, 1050.0F);