SPARK-1461 - price columns don't update tick format when security becomes known

This commit is contained in:
Jake Norbut committed 2018-07-17 13:35:03 -05:00
1 parent e40dc48fa8
commit 79e876e1dc
2 files changed
+8 -4

No files matched your search

@@ -21,7 +21,7 @@ namespace mbts.spark {
IOrderBookCell current { get; }
//
IOrderBookCellStore select_other(CVOrderBookRowVM row);
bool refresh();
bool refresh(bool force_refresh);
void regenerate_cell();
}
@@ -93,9 +93,9 @@ namespace mbts.spark {
public IOrderBookCellStore<T> select_other(CVOrderBookRowVM row) => _select_other(row);
IOrderBookCellStore IOrderBookCellStore.select_other(CVOrderBookRowVM row) => select_other(row);
public bool refresh() {
public bool refresh(bool force_refresh = false) {
T v = _get_value(_row);
if (!_eq_comparer.Equals(v, _current.value)) {
if (force_refresh || !_eq_comparer.Equals(v, _current.value)) {
_current = new OrderBookCell<T>(this, v);
_row.RaisePropertyChanged(_prop_name);
return true;
@@ -322,7 +322,11 @@ namespace mbts.spark {
void _update_partial(IEnumerable<IOrderBookCellStore> target_cell_stores) {
bool invalidate = false;
foreach (var cell_store in target_cell_stores) {
if (cell_store.refresh()) {
// although the price-related stores will be inlcuded in the IEnumerable,
// we need to force .refresh b/c the price* backing store's value does not
// change when the security becomes known
bool force_refresh = cell_store.prop_name.Equals(nameof(price)) || cell_store.prop_name.Equals(nameof(avg_price)) || cell_store.prop_name.Equals(nameof(last_price));
if (cell_store.refresh(force_refresh)) {
invalidate = true;
if (_book_vm.live_sorting_columns.Contains(cell_store.column.key)) {
// refresh the sort by calling regenerate_cell() for each descendent-row