Esempio n. 1
0
        //Constructor
        public PushForm(WeatherDataSubject subject)
        {
            InitializeComponent();

            //Store the subject.
            this.subject = subject;

            //subscribe this object to subject.
            subject.Attach(this);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 //Constructor
 public CurrentConditionDisplayPushObserver(WeatherDataSubject dataSubject)
 {
     this.dataSubject = dataSubject;
     dataSubject.Attach(this);
 }