Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Classic Observer");

            var ticker    = new StockTicker();
            var google    = new GoogleObserver(ticker);
            var microsoft = new MicrosoftObserver(ticker);

            foreach (var item in SampleData.GetNext())
            {
                ticker.Stock = item;
            }

            Console.WriteLine();
            Console.WriteLine("Event and Delegates");

            var stockTicker      = new Events.StockTicker();
            var googleMonitor    = new GoogleMonitor(stockTicker);
            var microsoftMonitor = new MicrosoftMonitor(stockTicker);

            foreach (var item in SampleData.GetNext())
            {
                stockTicker.Stock = item;
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public void JustUtil()
        {
            var st = new StockTicker();

            var gf = new GoogleMonitor(st);
            var mf = new MicrosoftMonitor(st);

            foreach (var s in SampleData.GetNext())
            {
                st.Stock = s;
            }
        }
Ejemplo n.º 3
0
        public void JustUtil()
        {
            var st = new StockTicker();

            var gf = new GoogleMonitor();
            var mf = new MicrosoftMonitor();

            using (st.Subscribe(gf))
                using (st.Subscribe(mf))
                    foreach (var s in SampleData.GetNext())
                    {
                        st.Stock = s;
                    }
        }
Ejemplo n.º 4
0
        public static void MainED(string[] args)
        {
            // Monitor a stock ticker, when particular events occur, react
            StockTicker st = new StockTicker();

            // Create New observers to listen to the stock ticker
            GoogleMonitor    gf = new GoogleMonitor(st);
            MicrosoftMonitor mf = new MicrosoftMonitor(st);

            // Load the Sample Stock Data
            foreach (var s in SampleData.getNext())
            {
                st.Stock = s;
            }
        }
Ejemplo n.º 5
0
        public static void RunDemo()
        {
            StockTicker stockTicker = new StockTicker();

            //// ReSharper disable UnusedVariable

            GoogleMonitor    googleMonitor    = new GoogleMonitor(stockTicker);
            MicrosoftMonitor microsoftMonitor = new MicrosoftMonitor(stockTicker);

            //// ReSharper restore UnusedVariable

            foreach (var stock in SampleData.GetNext())
            {
                stockTicker.Stock = stock;
            }
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            StockTicker st = new StockTicker();

            GoogleMonitor gf = new GoogleMonitor();
            MicrosoftMonitor mf = new MicrosoftMonitor();

            using (st.Subscribe(gf))
            using (st.Subscribe(mf))
            {
                foreach (var s in SampleData.getNext())
                {
                    st.Stock = s;
                }
            }
        }
Ejemplo n.º 7
0
        public static void Main(string[] args)
        {
            var st = new StockTicker();

            var gf = new GoogleMonitor();
            var mf = new MicrosoftMonitor();

            using (st.Subscribe(gf))
                using (st.Subscribe(mf))
                {
                    foreach (var s in SampleData.getNext())
                    {
                        st.Stock = s;
                    }
                }
        }
Ejemplo n.º 8
0
        public static void Run()
        {
            // Monitor a stock ticker, when particular events occur, react
            var st = new StockTicker();

            var gf = new GoogleMonitor();
            var mf = new MicrosoftMonitor();

            using (st.Subscribe(gf))
                using (st.Subscribe(mf))
                {
                    // Load the Sample Stock Data
                    foreach (var s in SampleData.getNext())
                    {
                        st.Stock = s;
                    }
                }
        }
Ejemplo n.º 9
0
        public static void RunDemo()
        {
            StockTicker stockTicker = new StockTicker();

            GoogleMonitor googleMonitor = new GoogleMonitor();
            MicrosoftMonitor microsoftMonitor = new MicrosoftMonitor();

            using (stockTicker.Subscribe(googleMonitor))
            {
                using (stockTicker.Subscribe(microsoftMonitor))
                {
                    foreach (var stock in SampleData.GetNext())
                    {
                        stockTicker.Stock = stock;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public static void RunDemo()
        {
            StockTicker stockTicker = new StockTicker();

            GoogleMonitor    googleMonitor    = new GoogleMonitor();
            MicrosoftMonitor microsoftMonitor = new MicrosoftMonitor();

            using (stockTicker.Subscribe(googleMonitor))
            {
                using (stockTicker.Subscribe(microsoftMonitor))
                {
                    foreach (var stock in SampleData.GetNext())
                    {
                        stockTicker.Stock = stock;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            //EventKeyWord();

            //TraditionalObserver();

            // Monitor a stock ticker, when particular events occur, react
            var st = new IObserver.StockTicker();

            GoogleMonitor    gf = new GoogleMonitor();
            MicrosoftMonitor mf = new MicrosoftMonitor();

            using (st.Subscribe(gf))
                using (st.Subscribe(mf))
                {
                    // Load the Sample Stock Data
                    foreach (var s in SampleData.getNext())
                    {
                        st.Stock = s;
                    }
                }
        }