SPARK-2491 - mass cancel
This commit is contained in:
1 parent
e98d18a5aa
commit
fb314f0eb1
5 files changed
+37
-4
No files matched your search
@@ -335,6 +335,7 @@ namespace mbts.spark {
|
||||
}
|
||||
obvm.columns.Insert(0, new OrderBookVM.UpdateColumn(typeof(MiniOrderBookView)));
|
||||
obvm.columns.Insert(0, new OrderBookVM.CancelColumn(nameof(OrderBookRowVM.cancel_command)));
|
||||
obvm.columns.Insert(0, new OrderBookVM.CheckColumn(nameof(OrderBookRowVM.is_checked)));
|
||||
|
||||
obvm.load_from(state);
|
||||
return obvm;
|
||||
|
||||
@@ -724,6 +724,28 @@ namespace mbts.spark {
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckColumn : FrameworkElementColumnBase<Columns> {
|
||||
readonly BindingBase _checked_binding;
|
||||
public CheckColumn(string checked_property) : base(Columns.Check) {
|
||||
id = key.ToString();
|
||||
Width = 30;
|
||||
_checked_binding = new Binding(checked_property);
|
||||
}
|
||||
|
||||
public override FrameworkElement view_factory() {
|
||||
var grid = new Grid() {
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
var cb = new CheckBox();
|
||||
cb.Name = "check_col";
|
||||
cb.SetBinding(CheckBox.IsCheckedProperty, _checked_binding);
|
||||
|
||||
grid.Children.Add(cb);
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
|
||||
public class CancelColumn : FrameworkElementColumnBase<Columns> {
|
||||
readonly BindingBase _command_binding;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace mbts.spark {
|
||||
Color? _root_algo_badge_color_backing;
|
||||
Brush _badge_fill, _root_algo_badge_fill;
|
||||
IRaiseCanExecuteChangedCommand _show_order_modify_cmd, _toggle_expanded_cmd, _cancel_cmd, _detach_command, _attach_command, _update_command, _modify_order_quantity_andor_price, _revert_prospective_order_quantity_andor_price;
|
||||
bool _is_parent, _is_expanded, _is_selected, _is_attachable, _is_detachable;
|
||||
bool _is_parent, _is_expanded, _is_selected, _is_attachable, _is_detachable, _is_checked;
|
||||
int _depth_level;
|
||||
SecurityImmutable? _security => order_tuple.security;
|
||||
// for mini-ob
|
||||
@@ -138,6 +138,10 @@ namespace mbts.spark {
|
||||
}
|
||||
public bool is_qty_dirty => this.prospective_quantity != this.quantity;
|
||||
public bool is_price_dirty => this.prospective_price != this.price;
|
||||
public bool is_checked {
|
||||
get => _is_checked;
|
||||
set => Set(ref _is_checked, value);
|
||||
}
|
||||
|
||||
// Commands
|
||||
public ICommand toggle_command => _toggle_expanded_cmd ?? (
|
||||
|
||||
@@ -572,8 +572,13 @@ namespace mbts.spark {
|
||||
internal void show_order_modify(OrderBookRowVM row) =>
|
||||
_bus.post(SparkTags.ShowModifyOrderTag, row.order_key);
|
||||
|
||||
internal void cancel_order(OrderBookRowVM row) =>
|
||||
_bus.post(SparkTags.CancelOrders, new List<uint> { row.order_key });
|
||||
internal void cancel_order(OrderBookRowVM row) {
|
||||
if (row.is_checked) {
|
||||
rows.Where(r => r.is_checked).ForEach((checked_row) => _bus.post(SparkTags.CancelOrders, new List<uint> { checked_row.order_key }));
|
||||
} else {
|
||||
_bus.post(SparkTags.CancelOrders, new List<uint> { row.order_key });
|
||||
}
|
||||
}
|
||||
|
||||
internal void modify_order_quantity(OrderBookRowVM row, uint size) =>
|
||||
_bus.post(SparkTags.UpdateOrder, (row.order_key, row.price, size));
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace mbts.spark {
|
||||
Update = 1 << 27,
|
||||
Commit = 1 << 28,
|
||||
RootAlgoType = 1 << 29,
|
||||
Piq = 1 << 30
|
||||
Piq = 1 << 30,
|
||||
Check = 1 << 31
|
||||
}
|
||||
|
||||
public OrderBookGridView() {
|
||||
|
||||
Reference in new issue
Block a user