ui: Add menu-orientation menu-item to Slide win
This commit is contained in:
1 parent
31745d9f0d
commit
63c77966fa
2 files changed
+17
-2
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
namespace mbts.analytics {
|
||||
using bts.api.analytics;
|
||||
using bts.shell;
|
||||
using bts.utils;
|
||||
|
||||
using mbts.user.settings;
|
||||
@@ -42,6 +43,9 @@ namespace mbts.analytics {
|
||||
[ProtoMember(7)]
|
||||
public PriceDisplayFactors? price { get; set; }
|
||||
|
||||
[ProtoMember(8)]
|
||||
public SparkMenuDisplaySettings menu_display { get; set; } = SparkMenuDisplaySettings.Default;
|
||||
|
||||
public bool Equals(SlideReportSettings? other) =>
|
||||
other is not null &&
|
||||
id == other.id &&
|
||||
@@ -49,7 +53,8 @@ namespace mbts.analytics {
|
||||
show_post_monthly_sum == other.show_post_monthly_sum &&
|
||||
show_post_quarterly_sum == other.show_post_quarterly_sum &&
|
||||
greeks.safe_sequence_equals(other.greeks) &&
|
||||
price.safe_equals(other.price);
|
||||
price.safe_equals(other.price) &&
|
||||
menu_display.Equals(other.menu_display);
|
||||
|
||||
public override bool Equals(object? obj) =>
|
||||
Equals(obj as SlideReportSettings);
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace mbts.analytics {
|
||||
using bts.collections;
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using bts.view;
|
||||
|
||||
using mbts.spark;
|
||||
using mbts.ui;
|
||||
@@ -23,6 +24,7 @@ namespace mbts.analytics {
|
||||
|
||||
SlideReportVM? _vm;
|
||||
SlideReportView? _view;
|
||||
SparkMenuDisplayVM? _menu_display_vm;
|
||||
SlideReportSettings _settings;
|
||||
|
||||
public SlideReportWindow(
|
||||
@@ -43,6 +45,8 @@ namespace mbts.analytics {
|
||||
get {
|
||||
if (_vm is not null) {
|
||||
_settings = _vm.get_state(_settings.id);
|
||||
_settings.menu_display = _menu_display_vm?.create() ??
|
||||
SparkMenuDisplaySettings.Default;
|
||||
}
|
||||
return _settings;
|
||||
}
|
||||
@@ -59,13 +63,16 @@ namespace mbts.analytics {
|
||||
Contract.Requires(_view is null);
|
||||
Contract.Requires(!_commands.Any());
|
||||
|
||||
_menu_display_vm = new();
|
||||
_menu_display_vm.load_from(_settings.menu_display);
|
||||
_vm = new(_settings, _bus);
|
||||
|
||||
_commands.AddRange(
|
||||
new SparkCommandCommand("Compute", Icons.Refresh, _vm.compute, new KeyGesture(Key.F5)),
|
||||
mk_toggle_expanded_cmd(),
|
||||
mk_toggle_use_canidate_vol_cmd(),
|
||||
new SparkCommandCommand("Settings", Icons.Gear, _vm.launch_settings_editor_cmd));
|
||||
new SparkCommandCommand("Settings", Icons.Gear, _vm.launch_settings_editor_cmd),
|
||||
_menu_display_vm.spark_cmd);
|
||||
|
||||
_view = new SlideReportView {
|
||||
DataContext = _vm
|
||||
@@ -90,5 +97,8 @@ namespace mbts.analytics {
|
||||
return spark_cmd;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnParentViewCreated(SparkWindowView parent_view) =>
|
||||
_menu_display_vm.safe_bind_to_view(parent_view);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user