Beispiel #1
0
        /// <summary>
        /// Adds the tick to watch list.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        public void AddSymbolToWatchList(string symbol)
        {
            if (string.IsNullOrEmpty(symbol))
            {
                return;
            }


            //Get the stock info
            var sivm = GetStockInfoBySymbolName(symbol);

            if (sivm != null)
            {
                return;
            }

            var brush = GetBrush(symbol);

            var stock = new StockInfoViewModel(this, symbol, brush, _stocks.Count > 0 ? _stocks[0].RangeFilter : 1);

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


            //if (service.GetViewIndex(symbol) == 1)
            //    stocks1.Add(stock);
            //else
            //    stocks2.Add(stock);

            //Get the data for the stock.
            RefreshData(stock);

            //RaisePropertyChanged("Tickers");
            RaiseTickerChanged(symbol);

            // If this is the first stock, lets automatically select it.
            if (_stocks.Count == 1 || SelectedStock == null)
            {
                SelectedStock = _stocks.First();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Refreshes the data.
 /// </summary>
 public void RefreshData(StockInfoViewModel stock)
 {
     //service.RefreshData(stock.Symbol, DateTime.Now.AddYears(-100), OnRefreshData);
     _service.Subscribe(stock.Symbol, OnSnapshotData, OnUpdateData);
 }