コード例 #1
0
        public void TraditionalTest()
        {
            // Monitor a stock ticker, when particular events occur, react
            OT.StockTicker subject = new OT.StockTicker();

            // Create New observers to listen to the stock ticker
            subject.Register(new OT.GoogleObserver());
            subject.Register(new OT.MicrosoftObserver());

            // Load the Sample Stock Data
            foreach (var s in SampleData.getNext())
            {
                subject.Stock = s;
            }
        }
コード例 #2
0
 public MicrosoftObserver(StockTicker subj)
 {
     this.DataSource = subj;
     subj.Register(this);
 }