private void ClientGotOrder(Order o) { int pos = OrderTable.Select(row => row.OrderId).ToList().IndexOf(o.Id); System.Windows.Application.Current.Dispatcher.Invoke(() => { if (pos == -1) // not found { OnDebug("Order id " + o.Id.ToString() + " is not found in order table; possibly new order."); // it must be previous open order, or placed by tws // add to _ordertracker _ordertracker.GotOrder(o); // update status OrderTable.Add(new OrderEntry(o.Id, o.Account, o.FullSymbol, o.OrderType, o.Price, o.OrderSize, o.OrderTime, EnumDescConverter.GetEnumDescription(o.OrderStatus))); } else { OrderTable[pos].Status = EnumDescConverter.GetEnumDescription(o.OrderStatus); } }); }