예제 #1
0
        //Constructor
        public PushForm(WeatherDataSubject subject)
        {
            InitializeComponent();

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

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