Exemplo n.º 1
0
 private void AddWatchStock(string stockSymbol)
 {
     if (!WatchListItems.Any(x => x.TickerSymbol.Equals(stockSymbol)))
     {
         PopulateWatchItemsList(new string[] { stockSymbol });
     }
 }
Exemplo n.º 2
0
        private void RemoveWatch(string tickerSymbol)
        {
            var item = WatchListItems.FirstOrDefault(w => w.TickerSymbol.Equals(tickerSymbol, StringComparison.InvariantCultureIgnoreCase));

            if (item != null)
            {
                WatchListItems.Remove(item);
            }
        }
Exemplo n.º 3
0
        private void PopulateWatchItemsList(IEnumerable <string> watchItemsList)
        {
            //WatchListItems.Clear();
            foreach (string tickerSymbol in watchItemsList)
            {
                decimal?currentPrice;
                try
                {
                    currentPrice = marketFeedService.GetPrice(tickerSymbol);
                }
                catch (ArgumentException)
                {
                    currentPrice = null;
                }

                WatchListItems.Add(new WatchItem(tickerSymbol, currentPrice));
            }
        }