SyntheticEditor changes

This commit is contained in:
John Colvin committed 2017-10-13 16:35:15 -04:00
1 parent 3cadac9ece
commit 3ac340f2dd
4 files changed
+17 -5

No files matched your search

@@ -18,7 +18,7 @@ namespace mbts.spark.menu_items
private readonly IBus _bus;
public string display_name => "Create Synthetic...";
public string display_name => "Create Synthetic Spread...";
public int priority => 2;
public ImageSource icon => Icons.Tetris;
public string sectional_id => MenuItemSections.SecurityWindow;
@@ -17,7 +17,7 @@ namespace mbts.spark.menu_items
private readonly IBus _bus;
public string display_name => "Execution Strategy...";
public string display_name => "Edit Synthetic Spread...";
public int priority => 1;
public ImageSource icon => Icons.Knight;
public string sectional_id => MenuItemSections.SecurityWindow;
@@ -4,6 +4,7 @@
xmlns:u="clr-namespace:mbts.ui"
xmlns:c="clr-namespace:mbts.ui.controls"
xmlns:usp="clr-namespace:mbts.ui.spark"
u:WindowStyle.TitleContent="{Binding}"
u:WindowStyle.SizeToContent="WidthAndHeight"
Style="{StaticResource BTSDialogTitleTemplate}">
<Window.Resources>
@@ -24,8 +25,8 @@
<u:WindowStyle.TitleContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Margin="3,1" Source="{x:Static u:Icons.Tetris}"/>
<TextBlock>Synthetic Editor</TextBlock>
<Image Margin="3,1" Source="{Binding icon}"/>
<TextBlock Text="{Binding title}"/>
</StackPanel>
</DataTemplate>
</u:WindowStyle.TitleContentTemplate>
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
using System.Windows.Media;
namespace mbts.spark
{
@@ -22,8 +23,16 @@ namespace mbts.spark
public SyntheticEditorVM(IBus bus, Security synthetic, ExecutionStrategy strategy) {
_synthetic = synthetic;
leg_tuples = _synthetic.Synthetic.Legs.Select(l => new LegSpreaderParamsTuple(l, strategy.LegParamsMap[l.Security.Id])).ToList();
bool is_new = synthetic.Id == 0;
if (is_new) {
title = "Create Synthetic Spread";
icon = Icons.Tetris;
} else {
title = $"Edit '{synthetic.Synthetic.Name}'";
icon = Icons.Knight;
}
rows = new IRowModel [] {
new SizeModel(synthetic.Id != 0),
new SizeModel(!is_new),
new PriceMultiplierModel(),
new IsQuoteModel(),
new EnableHedgingModel(),
@@ -50,6 +59,8 @@ namespace mbts.spark
private readonly Security _synthetic;
public string title { get; }
public ImageSource icon { get; }
public string name { get => _synthetic.Synthetic.Name; set => _synthetic.Synthetic.Name = value; }
public SyntheticContract.Types.PriceCalc price_calc { get => _synthetic.Synthetic.PriceCalc; set => _synthetic.Synthetic.PriceCalc = value; }
public IReadOnlyCollection<LegSpreaderParamsTuple> leg_tuples { get; }