private void AnimateStockItemCore(WatchedStockItemModel stockItem) { var animators = from wrapGrid in this.StockItems.Descendants<WrapGrid>() from presenter in wrapGrid.Descendants<ContentPresenter>() where presenter.Content == stockItem from button in presenter.Descendants<Button>() select new ButtonColorRangeAnimator(button, stockItem.ColorRange); foreach (var animator in animators) { animator.Begin(); } }
public void OnAddStock(string symbol, int quantity) { var item = new WatchedStockItemModel { Symbol = symbol, ColorRange = this.colorRanges.GetNext(), Quantity = quantity }; int index = this.view.Model.StockItems.Count - 1; this.view.Model.StockItems.Insert(index, item); var subscribedToStockEvent = this.eventAggregator.GetEvent<SubscribedToStockEvent>(); subscribedToStockEvent.Publish(new SubscribedToStockEventArgs(symbol)); }
public void AnimateStockItem(WatchedStockItemModel stockItem) { this.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => this.AnimateStockItemCore(stockItem)); }