コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public void AnimateStockItem(WatchedStockItemModel stockItem) {
     this.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => this.AnimateStockItemCore(stockItem));
 }