Exemplo n.º 1
0
        public void Run()
        {
            WordList wordList = new WordList();
            WordObserver wordObserver = new WordObserver();

            wordList.Attatch(wordObserver);
            {
                wordList.Messages.Add("Hello");
                wordList.NotifyAll();

                wordList.Messages.Add("Message");

                wordList.Messages.Add("Tester");
                foreach(IObserver ob in wordList.GetObservers())
                {
                    wordList.Notify(ob);
                }
            }
            wordList.Detach(wordObserver);
        }
Exemplo n.º 2
0
        public void Run()
        {
            WordList     wordList     = new WordList();
            WordObserver wordObserver = new WordObserver();

            wordList.Attatch(wordObserver);
            {
                wordList.Messages.Add("Hello");
                wordList.NotifyAll();

                wordList.Messages.Add("Message");


                wordList.Messages.Add("Tester");
                foreach (IObserver ob in wordList.GetObservers())
                {
                    wordList.Notify(ob);
                }
            }
            wordList.Detach(wordObserver);
        }