SP-77 in miniob settings, changing the column order does not seem to have an effect

This commit is contained in:
John Colvin committed 2019-06-24 14:15:50 -05:00
1 parent 56ace9514a
commit 3263cc840a
2 files changed
+12 -22

No files matched your search

@@ -1,6 +1,7 @@
using bts.api;
using bts.api.orderman;
using mbts.spark.utilities;
using bts.shell.orderbook;
using mbts.persist;
using mbts.ui;
using mbts.ui.shell;
using System;
@@ -293,7 +294,6 @@ namespace mbts.spark {
price_filter.minimum.value = real_price;
price_filter.maximum.value = real_price;
var obvm = new OrderBookVM(_owner.bus, null, _owner.model.order_gateway, null, true);
var state = new bts.shell.orderbook.OrderBookStartupData(
new bts.shell.orderbook.FilterStates {
security_criteria = new SecurityCriteria(_owner.security),
@@ -304,29 +304,19 @@ namespace mbts.spark {
bts.shell.orderbook.OrderBookStartupData.default_mini_grid.with(_owner.current_settings.mini_ob.value),
use_defaults: false
);
// NOTE:
// we might need the ObservableAppend to InsertAt
// if these EditXXX ever support settings.
// The end result after this group of lines will be
// ----------------------------------------------
// | Cancel | Update | Qty | Price | Commit | Attach | Detach | ...
// ----------------------------------------------
//
var settings_man = new WindowSettingsManager<OrderBookGridSettings>.DisconnectedImpl(state.orderbook_grid);
var obvm = new OrderBookVM(_owner.bus, null, _owner.model.order_gateway, settings_man, true);
_owner.settings.Subscribe(s => settings_man.instance_settings = settings_man.instance_settings.with(s.mini_ob.value));
obvm.columns.Insert(0, new OrderBookVM.AttachDetachColumn(typeof(MiniOrderBookView)));
obvm.columns.Insert(0, new OrderBookVM.CommitColumn());
if (obvm.columns.Any(x => x.id == OrderBookGridView.ColumnKeys.Price.ToString()) && !obvm.columns.Any(x => x.id == OrderBookGridView.ColumnKeys.EditablePrice.ToString())) {
// insert the edit price column at the beginning
obvm.columns.Insert(0, new OrderBookVM.EditablePriceColumn());
}
if (obvm.columns.Any(x => x.id == OrderBookGridView.ColumnKeys.Size.ToString()) && !obvm.columns.Any(x => x.id == OrderBookGridView.ColumnKeys.EditableQty.ToString())) {
// insert the edit quantity column at the beginning
obvm.columns.Insert(0, new OrderBookVM.EditableQtyColumn());
}
obvm.columns.Insert(0, new OrderBookVM.EditablePriceColumn());
obvm.columns.Insert(0, new OrderBookVM.EditableQtyColumn());
obvm.columns.Insert(0, new OrderBookVM.UpdateColumn(typeof(MiniOrderBookView)));
obvm.columns.Insert(0, new OrderBookVM.CancelColumn(nameof(OrderBookRowVM.cancel_command)));
obvm.columns.insert_front( new OrderBookVM.CheckColumn(nameof(OrderBookRowVM.is_selected)));
// the CheckColumn must be inserted at the front of the ObservableAppendCollection,
// and not mixed with the other columns in said ObservableAppendCollection's underlying ObservableCollection (the settings dialog uses the underlying collection).
// The user cannot adjust this column in the settings dialog, and it should always be the left-most column.
obvm.columns.insert_front(new OrderBookVM.CheckColumn(nameof(OrderBookRowVM.is_selected)));
obvm.load_from(state);
return obvm;
}
@@ -155,7 +155,7 @@ namespace mbts.spark {
vm.RequestClose += (s, e) => WindowUtilities.force_close(dialog);
return dialog;
}));
grid_settings_manager = new OrderBookGridSettingsManager(bus, notification_service, model, rows, columns);
grid_settings_manager = new OrderBookGridSettingsManager(bus, notification_service, model, rows, core_columns);
grid_settings_manager.algo_tree_display_mode_changed += _on_filter_changed;
IDisposable attach_vm_hooks = null;
begin_attaching += on_begin_attaching;