SPARK-460: OrderBook performancce issues - grid is now virtualizing rows correctly
This commit is contained in:
1 parent
3d7efd5686
commit
2378b3cb05
1 file changed
+7
-2
@@ -32,6 +32,7 @@ namespace mbts.spark
|
||||
_creator = factory;
|
||||
_bus = bus;
|
||||
_model = model;
|
||||
_visible_orders = new ObservableFilterCollection<OrderBookRowVM>(_orders, o => o.is_visible);
|
||||
|
||||
_order_records = new ObservableCollection<OrderRecordImmutable>();
|
||||
_current_row = backing<OrderBookRowVM>(nameof(current_row));
|
||||
@@ -51,11 +52,13 @@ namespace mbts.spark
|
||||
})
|
||||
.ObserveOnDispatcher()
|
||||
.Subscribe(orders_with_found_securities => {
|
||||
_orders.sync_with(orders_with_found_securities);
|
||||
using (_visible_orders.defer_refresh()) {
|
||||
_orders.sync_with(orders_with_found_securities);
|
||||
}
|
||||
on_order_received();
|
||||
});
|
||||
|
||||
orders_view = CollectionViewSource.GetDefaultView(_orders);
|
||||
orders_view = CollectionViewSource.GetDefaultView(_visible_orders);
|
||||
orders_view.SetSortingCriteria(
|
||||
state.sort_criteria != null && state.sort_criteria.Any() ?
|
||||
state.sort_criteria :
|
||||
@@ -111,6 +114,7 @@ namespace mbts.spark
|
||||
order.is_visible = visible;
|
||||
}
|
||||
}
|
||||
_visible_orders.trigger_filter();
|
||||
}
|
||||
|
||||
internal bool order_has_children(uint order_key) {
|
||||
@@ -160,6 +164,7 @@ namespace mbts.spark
|
||||
|
||||
|
||||
private ObservableCollection<OrderBookRowVM> _orders = new ObservableCollection<OrderBookRowVM>();
|
||||
private ObservableFilterCollection<OrderBookRowVM> _visible_orders;
|
||||
|
||||
private IEnumerable<OrderRecordImmutable> _active_order_records => _orders.Where(x => x.order.is_active()).Select(x => x.order);
|
||||
public IEnumerable<uint> active_order_keys => _active_order_records.Select(o => o.Key);
|
||||
|
||||
Reference in new issue
Block a user