Пример #1
0
        /// <summary> Adds multiple stocks to watch list. </summary>
        public void WatchListAddStock(List <string> symbols)
        {
            foreach (var symbol in symbols)
            {
                // check if we already have the stock and if is valid
                if (ContainsStockSymbol(symbol))
                {
                    continue;
                }
                if (!IsValidStockSymbol(symbol))
                {
                    continue;
                }

                // find the next brush to use
                var brush = _stockBrushes.ElementAtOrNext(_stocks.Count);

                var stock = new StockTradeData(this, symbol, brush);

                // get the data for the stock.
                StockService.RequestStockHistoryAsync(stock.Symbol, OnRefreshData);

                // Add the stock to the other stocks.
                _stocks.Add(stock);

                Logs.Message(this, "AddedStock: " + symbol);
            }

            if (SelectedStock == null && _stocks.Count > 0)
            {
                this.SelectedStock            = _stocks.First();
                this.SelectedStock.IsSelected = true;
            }
        }