Ejemplo 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);
        }
Ejemplo 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);
        }