private void btn_run_Click(object sender, RoutedEventArgs e)
        {
            Lecturer john = new Lecturer();
            Student s1 = new Student("Craig");
            Student s2 = new Student("Mark");

            john.registerObservers(s1);
            john.registerObservers(s2);

            john.setNews("Free beer on Wednesday at 4:00");
            john.notiffyObservers();

            john.removeObservers(s2);

            john.setNews("Beer cancelled");
            john.notiffyObservers();
        }
Esempio n. 2
0
 public void removeObservers(Student s)
 {
     this.myStudents.Remove(s);
 }
Esempio n. 3
0
 // Methods
 public void registerObservers(Student s)
 {
     this.myStudents.Add(s);
 }