public void RefreshStockData(StockInfoViewModel stockInfoViewModel) { _stockService.RefreshData(stockInfoViewModel.Symbol, DateTime.Now.AddYears(-1 * stockInfoViewModel.RangeFilter), OnRefreshData); //MT remove //_stockService.RefreshDetails(_stockSearchList.Select(x => x.Symbol).ToList(), OnRefreshDetails); }
/// <summary> /// Adds the tick to watch list. /// </summary> /// <param name="symbol">The symbol.</param> public void AddSymbolToWatchList(string symbol) { if (string.IsNullOrEmpty(symbol)) { return; } //See if the symbol is actually an existing stock if (!CheckForExistingStockBySymbolName(symbol)) { return; } //Get the stock info var sivm = GetStockInfoBySymbolName(symbol); if (sivm != null) { return; } int iBrushIndex = _stocks.Count(); // If we have more stocks than brushes, lets find the next brush to use Brush brush = null; if (_stockColors != null) { while (iBrushIndex > _stockColors.Count - 1) { iBrushIndex = iBrushIndex - _stockColors.Count; } brush = iBrushIndex < _stockColors.Count ? _stockColors[iBrushIndex] : null; } StockInfoViewModel stockViewModel = new StockInfoViewModel(this, _stockDetailsDictionary[symbol], brush, _stocks.Count > 0 ? _stocks[0].RangeFilter : 3); _stocks.Add(stockViewModel); RefreshStockData(stockViewModel); RaisePropertyChanged("Tickers"); // If this is the first stock, lets automatically select it. if (_stocks.Count == 1 || SelectedStock == null) { SelectedStock = _stocks.First(); } }