diff --git a/src/client/spark/Modules/Spreader/SyntheticManagementView.xaml b/src/client/spark/Modules/Spreader/SyntheticManagementView.xaml index e39b73ff9..8610ddb5e 100644 --- a/src/client/spark/Modules/Spreader/SyntheticManagementView.xaml +++ b/src/client/spark/Modules/Spreader/SyntheticManagementView.xaml @@ -16,6 +16,12 @@ GridLinesVisibility="None" ItemsSource="{Binding rows_view}" CurrentItem="{Binding current_row, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" > + + + { + readonly IBus _bus; readonly OrdersModel _orders_model; public SyntheticManagementDialogVM(IBus bus, OrdersModel orders_model) : this(bus, orders_model, null, null) { } public SyntheticManagementDialogVM(IBus bus, OrdersModel orders_model, IReadOnlyCollection sorting, FilterStates filters) : base(orders_model.spreader.strategy_tuple.Select(map => map.Values), sorting) { + _bus = bus; _orders_model = orders_model; if (filters != null) { create_time_filter.load_state(filters.create_time); @@ -27,7 +30,7 @@ namespace mbts.spark { } protected override Row row_factory((ExecutionStrategyImmutable? strategy, SecurityMD md) row_model) => - new Row(row_model.md, row_model.strategy, _orders_model); + new Row(_bus, row_model.md, row_model.strategy, _orders_model); protected override void on_row_removed(Row row) => row.Dispose(); @@ -54,10 +57,13 @@ namespace mbts.spark { new PartFormattingTuple(ContractParts.Symbol), new PartFormattingTuple(ContractParts.RawExp, "l") }; + + readonly IBus _bus; readonly ExecutionStrategyImmutable? _strategy; readonly Property _n_working_orders; - public Row(SecurityMD security_md, ExecutionStrategyImmutable? strategy, OrdersModel orders_model) : base(security_md) { + public Row(IBus bus, SecurityMD security_md, ExecutionStrategyImmutable? strategy, OrdersModel orders_model) : base(security_md) { + _bus = bus; _strategy = strategy; _n_working_orders = backing(nameof(n_working_orders), orders_model.on_security_orders(security_key) @@ -68,6 +74,7 @@ namespace mbts.spark { name = security.Synthetic.Name; n_legs = security.Synthetic.Legs.Count(); description = Format(security, _desc_parts); + show_ladder = new DelegateCommand(_show_ladder); } public DateTime create_time => DateTime.MinValue; //TODO @@ -76,6 +83,9 @@ namespace mbts.spark { public string description { get; } public bool strategy_present => _strategy.HasValue; public uint n_working_orders => _n_working_orders.Value; + public ICommand show_ladder { get; } + + void _show_ladder() => _bus.post(SparkTags.ShowLadderTag, md); } } } \ No newline at end of file