Contract Picker - double click security in single-pick mode

This commit is contained in:
Jake Norbut committed 2017-12-08 15:01:39 -06:00
1 parent 9fc0c55e48
commit c4deae2b0f
2 files changed
+18 -7

No files matched your search

@@ -81,23 +81,24 @@ namespace mbts.spark
private void _compose_criteria_clause_name() {
string proposed_name = string.Empty;
string fs = "{0} {1} {2}";
if (selected_securities.Count > 0) {
proposed_name = all_securities.Where(s => selected_securities.Contains(s.Key)).Select(sec => sec.Value.security.ToString()).Aggregate((i, j) => $"{i} {dot} {j}");
proposed_name = all_securities.Where(s => selected_securities.Contains(s.Key)).Select(sec => sec.Value.security.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j));
} else if (selected_symbols.Count > 0) {
proposed_name = $"{selected_symbols.Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name = selected_symbols.Aggregate((i, j) => String.Format(fs, i, dot, j));
if (selected_security_types.Count > 0) {
proposed_name += $" {selected_security_types.Select(sec_type => sec_type.ToString()).Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name += $", {selected_security_types.Select(sec_type => sec_type.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j))}";
}
if (selected_exchanges.Count > 0) {
proposed_name += $" at {selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name += $" at {selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j))}";
}
} else if (selected_security_types.Count > 0) {
proposed_name = $"{selected_security_types.Select(sec_type => sec_type.ToString()).Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name = $", {selected_security_types.Select(sec_type => sec_type.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j))}";
if (selected_exchanges.Count > 0) {
proposed_name += $" at {selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name += $" at {selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j))}";
}
} else if (selected_exchanges.Count > 0) {
proposed_name = $"{selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => $"{i} {dot} {j}")}";
proposed_name = $"{selected_exchanges.Select(exch => exch.ToString()).Aggregate((i, j) => String.Format(fs, i, dot, j))}";
}
criteria_input_name = proposed_name;
}
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:mbts.ui.converters"
xmlns:c="clr-namespace:mbts.ui.controls"
xmlns:ui="clr-namespace:mbts.ui"
x:ClassModifier="internal"
mc:Ignorable="d" d:DesignWidth="550" Height="500" Width="550">
<UserControl.Resources>
@@ -48,6 +49,15 @@
ItemsSource="{Binding securities}"
ScrollViewer.VerticalScrollBarVisibility="Visible"
HorizontalAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.is_edit_mode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}" Value="False">
<Setter Property="ui:AttachedCommands.DoubleClick" Value="{Binding DataContext.ok_button_command, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
<Grid Grid.Row="1" Margin="0,10,0,0">