コード例 #1
0
        private void UpdateStockItem(StockExchange stock)
        {
            var addedStock = StockDatas.FirstOrDefault(item => item.Symbol == stock.Symbol);

            if (addedStock != null)
            {
                int index = StockDatas.IndexOf(addedStock);
                StockDatas[index].Price    = stock.Price;
                StockDatas[index].Volume   = stock.Volume;
                StockDatas[index].DateTime = stock.DateTime;
            }
        }
コード例 #2
0
 private void AddOrUpdateStockExchange(StockExchange stock)
 {
     if (StockDatas.Any(item => item.Symbol == stock.Symbol))
     {
         UpdateStockItem(stock);
     }
     else
     {
         Application.Current.Dispatcher.Invoke(delegate()
         {
             StockDatas.Add(stock);
         });
     }
 }