ui: Refine slide win
* dock account/risk terms to the left
This commit is contained in:
1 parent
a53dfd14b1
commit
0b11b83eb5
4 files changed
+47
-55
No files matched your search
@@ -19,7 +19,8 @@ namespace mbts.analytics {
|
||||
public const int VERSION = 3;
|
||||
|
||||
public static SlideReportSettings Default(int id = -1) => new() {
|
||||
id = id
|
||||
id = id,
|
||||
show_upper_status_bar = true
|
||||
};
|
||||
|
||||
[ProtoMember(1)]
|
||||
@@ -43,6 +44,9 @@ namespace mbts.analytics {
|
||||
[ProtoMember(7)]
|
||||
public PriceDisplayFactors? price { get; set; }
|
||||
|
||||
[ProtoMember(9)]
|
||||
public bool show_upper_status_bar { get; set; }
|
||||
|
||||
[ProtoMember(8)]
|
||||
public SparkMenuDisplaySettings menu_display { get; set; } = SparkMenuDisplaySettings.Default;
|
||||
|
||||
@@ -54,6 +58,7 @@ namespace mbts.analytics {
|
||||
show_post_quarterly_sum == other.show_post_quarterly_sum &&
|
||||
greeks.safe_sequence_equals(other.greeks) &&
|
||||
price.safe_equals(other.price) &&
|
||||
show_upper_status_bar == other.show_upper_status_bar &&
|
||||
menu_display.Equals(other.menu_display);
|
||||
|
||||
public override bool Equals(object? obj) =>
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace mbts.analytics {
|
||||
using mbts.ui.utility;
|
||||
using mbts.user.settings;
|
||||
|
||||
using Spark.ViewModel.Commands;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -45,9 +47,11 @@ namespace mbts.analytics {
|
||||
public SlideReportVM(SlideReportSettings startup_data, IBus bus) {
|
||||
_view_format = backing<SlideViewFormat>(nameof(view_format));
|
||||
_use_candidate_values = backing<bool>(nameof(use_candidate_values));
|
||||
show_upper_status_bar = startup_data.show_upper_status_bar;
|
||||
|
||||
var resources = new DisposableCombo(included_exps.Subscribe((s, e) => _set_ui_overrides()));
|
||||
_model = new SlideDataModel(startup_data.id, bus);
|
||||
resources += toggle_show_upper_status_bar_cmd.bind(this, nameof(show_upper_status_bar));
|
||||
resources += ObservableAutoWrapper.connect(_handles, columns, mk_col);
|
||||
resources += _view_format.Subscribe(_ => _sync_grid());
|
||||
|
||||
@@ -145,6 +149,11 @@ namespace mbts.analytics {
|
||||
public IObservable<SlideViewFormat> view_format_observable =>
|
||||
_view_format.observe_current(true);
|
||||
|
||||
public bool show_upper_status_bar {
|
||||
get => toggle_show_upper_status_bar_cmd.is_selected;
|
||||
set => toggle_show_upper_status_bar_cmd.is_selected = value;
|
||||
}
|
||||
|
||||
public TimeFilterTuple time_filter {
|
||||
get => _time_filter;
|
||||
set {
|
||||
@@ -223,6 +232,7 @@ namespace mbts.analytics {
|
||||
public ICommand compute => new Command(_model.calculate);
|
||||
public ICommand time_shift_value_tick_up => new Command(() => time_shift += 0.25);
|
||||
public ICommand time_shift_value_tick_down => new Command(() => time_shift -= 0.25);
|
||||
public IToggleCommand toggle_show_upper_status_bar_cmd { get; } = new ToggleCommand();
|
||||
public IDialogCommand launch_settings_editor_cmd { get; }
|
||||
|
||||
public void cell_selection_changed(
|
||||
@@ -276,7 +286,8 @@ namespace mbts.analytics {
|
||||
id = id_override ?? _data.report_parameters.Id,
|
||||
view_format = view_format,
|
||||
greeks = _greeks_display_model.greek_displays.ToArray(),
|
||||
price = _price_display
|
||||
price = _price_display,
|
||||
show_upper_status_bar = show_upper_status_bar
|
||||
};
|
||||
|
||||
static string _handle_key(double percent_handle_move) =>
|
||||
|
||||
@@ -102,39 +102,32 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<!--PADDING-->
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="*" />
|
||||
<!--PADDING-->
|
||||
<RowDefinition Height="8" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--PADDING-->
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!--SPACING-->
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!--SPACING-->
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!--PADDING-->
|
||||
<ColumnDefinition Width="8" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Margin="8"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding show_upper_status_bar, Converter={x:Static cv:BooleanToVisibilityConverter.Instance}}">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding internal_account, Mode=OneWay}"
|
||||
ToolTip="Internal Account" />
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Margin="4,0" Text="|" />
|
||||
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding risk_terms_name, Mode=OneWay}"
|
||||
ToolTip="Risk Terms" />
|
||||
|
||||
<c:ComboCheckBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8,0"
|
||||
HeaderContent="Expirations"
|
||||
VerticalAlignment="Center"
|
||||
ItemsSource="{Binding expirations}"
|
||||
SelectedItems="{Binding included_exps}"
|
||||
ItemTemplate="{StaticResource ExpirationItemTemplate}"
|
||||
>
|
||||
ItemTemplate="{StaticResource ExpirationItemTemplate}">
|
||||
<c:ComboCheckBox.ToolTip>
|
||||
<TextBlock MaxWidth="340" TextWrapping="Wrap">
|
||||
<TextBlock.Text>
|
||||
@@ -147,13 +140,7 @@
|
||||
</c:ComboCheckBox.ToolTip>
|
||||
</c:ComboCheckBox>
|
||||
|
||||
<c:PopupControl
|
||||
Grid.Row="1"
|
||||
Grid.Column="3"
|
||||
Padding="6,3,5,3"
|
||||
VerticalAlignment="Center"
|
||||
Header="Trade Time Filter"
|
||||
>
|
||||
<c:PopupControl Padding="6,3,5,3" VerticalAlignment="Center" Header="Trade Time Filter">
|
||||
<c:PopupControl.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding}" />
|
||||
@@ -167,25 +154,7 @@
|
||||
End="{Binding time_filter_end}"
|
||||
/>
|
||||
</c:PopupControl>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="5"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding internal_account, Mode=OneWay}"
|
||||
ToolTip="Internal Account"
|
||||
/>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="7"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding risk_terms_name, Mode=OneWay}"
|
||||
ToolTip="Risk Terms"
|
||||
/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<c:DataGridEx
|
||||
x:Name="sum_grid"
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace mbts.analytics {
|
||||
using mbts.spark;
|
||||
using mbts.ui;
|
||||
|
||||
using Spark.Model;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -71,6 +73,11 @@ namespace mbts.analytics {
|
||||
new SparkCommandCommand("Compute", Icons.Refresh, _vm.compute, new KeyGesture(Key.F5)),
|
||||
mk_toggle_expanded_cmd(),
|
||||
mk_toggle_use_canidate_vol_cmd(),
|
||||
new SparkMenuItemToggleModel(
|
||||
"Show Account & Risk Terms", cmd: _vm.toggle_show_upper_status_bar_cmd) {
|
||||
show_in_context_menu = true,
|
||||
show_in_toolbar = false
|
||||
},
|
||||
new SparkCommandCommand("Settings", Icons.Gear, _vm.launch_settings_editor_cmd),
|
||||
_menu_display_vm.spark_cmd);
|
||||
|
||||
|
||||
Reference in new issue
Block a user