//Constructor public PushForm(WeatherDataSubject subject) { InitializeComponent(); //Store the subject. this.subject = subject; //subscribe this object to subject. subject.Attach(this); }
public Form1() { InitializeComponent(); subject = new WeatherDataSubject(); //Create an object from every subscriber form. PushForm pushForm = new PushForm(subject); PullForm pullForm = new PullForm(subject); //show the subscriber's forms. pushForm.Show(); pullForm.Show(); }
//Constructor public CurrentConditionDisplayPushObserver(WeatherDataSubject dataSubject) { this.dataSubject = dataSubject; dataSubject.Attach(this); }