private void SubscribePrices() { var prices = ApplicationSettings.Instance.PricesToWatch; var priceInfoList = new ObservableCollection<PriceInfo>(); foreach (var market in prices) { var id = market.MarketId; var priceInfo = new PriceInfo { MarketId = id, MarketName = market.Name }; priceInfo.Color = new SolidColorBrush(PriceGraph.GetGraphColor(id.ToString())); priceInfoList.Add(priceInfo); PriceGraphSingle.SetGraphBrush(priceInfo.MarketId.ToString(), priceInfo.Color); State.Data.SubscribePrices(id, price => { //var priceBar = State.Data.GetPriceBar(price.MarketId); priceInfo.Price = price.Price; priceInfo.Change = price.Change; OnGraphUpdate(price); }); } PricesView.DataContext = priceInfoList; }
void RaiseSelectedChanged(PriceInfo val) { if (SelectedChanged != null) SelectedChanged(this, new SelectedPriceChangedArgs { Val = val }); }