private static void Main(string[] args) { var shoppy = new Shoppy(); shoppy.TestShoppy(); return; ; var stockTicker = new StockTicker(); var stockListner = new RxStockMonitor(stockTicker); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 100, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 150, QuoteSymbol = "INTC" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 170, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 195.5M, QuoteSymbol = "MSFT" })); while (true) { Console.Write("enter symbol: "); var symbol = Console.ReadLine(); if (symbol.ToLower() == "x") { break; } Console.WriteLine("enter value: "); var val = decimal.Parse(Console.ReadLine()); for (int i = 0; i < 30; i++) { int i1 = i; Task.Run(() => stockTicker.Notify(new StockTick() { Price = val, QuoteSymbol = symbol + i1 })); } } Console.WriteLine("Bye Bye"); }
private static void Main(string[] args) { var shoppy = new Shoppy(); shoppy.TestShoppy(); return; ; var stockTicker = new StockTicker(); var stockListner = new RxStockMonitor(stockTicker); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 100, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 150, QuoteSymbol = "INTC" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 170, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 195.5M, QuoteSymbol = "MSFT" })); while (true) { Console.Write("enter symbol: "); var symbol = Console.ReadLine(); if (symbol.ToLower() == "x") { break; } Console.WriteLine("enter value: "); var val = decimal.Parse(Console.ReadLine()); for (int i = 0; i < 30; i++) { int i1 = i; Task.Run(() => stockTicker.Notify(new StockTick() { Price = val, QuoteSymbol = symbol + i1 })); } } Console.WriteLine("Bye Bye"); }