private void AddWatchStock(string stockSymbol) { if (!WatchListItems.Any(x => x.TickerSymbol.Equals(stockSymbol))) { PopulateWatchItemsList(new string[] { stockSymbol }); } }
private void RemoveWatch(string tickerSymbol) { var item = WatchListItems.FirstOrDefault(w => w.TickerSymbol.Equals(tickerSymbol, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { WatchListItems.Remove(item); } }
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)); } }