private void HandleDeletedLimitOrder(ILimitOrder order) { order.UnRegisterDeleteNotificationHandler(HandleDeletedLimitOrder); order.UnRegisterFilledNotification(HandleDeletedLimitOrder); LimitOrders.Remove(order.ExchangeOrderId); ClientOrders[order.ClientId].Remove(order); }
void client_LimitOrderDeleted(object sender, LimitOrderDto e) { UiDispatcher.Dispatcher.Invoke(() => { var order = LimitOrders.FirstOrDefault(a => a.OrderId == e.ExchangeOrderId); if (order == null) { return; } LimitOrders.Remove(order); order.Dispose(); }); }
void client_LimitOrderSnapshot(object sender, System.Collections.Generic.List <LimitOrderDto> e) { UiDispatcher.Dispatcher.Invoke(() => { LimitOrders.Clear(); foreach (var limitOrderViewModel in LimitOrders) { LimitOrders.Remove(limitOrderViewModel); limitOrderViewModel.Dispose(); } foreach (var limitOrder in e) { LimitOrders.Add(new LimitOrderViewModel(limitOrder, client)); } }); }