Launcher menu structure looks right
This commit is contained in:
1 parent
27b66cac06
commit
800f87fca7
12 files changed
+139
-206
No files matched your search
@@ -31,7 +31,6 @@ namespace bts.spark
|
||||
public static SparkCommand ShowOrderTicket { get; } =
|
||||
SparkCommand.create("Order Ticket", Icons.Ticket, SparkTags.ShowOrderTicketTag);
|
||||
|
||||
|
||||
// Spreader
|
||||
public static SparkCommand ShowSyntheticSpreads { get; }
|
||||
= SparkCommand.create("Synthetic Spreads", Icons.Spreads, SparkTags.NotImplemented);
|
||||
@@ -47,11 +46,15 @@ namespace bts.spark
|
||||
|
||||
// Support
|
||||
public static SparkCommand ShowManual { get; } =
|
||||
SparkCommand.create("Manual", Icons.Book, SparkTags.ShowUri, new Uri("bts://manual"));
|
||||
SparkCommand.create("Manual", Icons.Book, SparkTags.ShowUri, new Uri("bts://m/"));
|
||||
|
||||
public static SparkCommand ShowAuditLogs { get; }
|
||||
|
||||
public static SparkCommand ShowDiagnostics { get; }
|
||||
public static SparkCommand ShowAboutSpans { get; }
|
||||
public static SparkCommand ShowAboutSpark { get; } =
|
||||
SparkCommand.create("Contact Support", Icons.Support, SparkTags.Support);
|
||||
public static SparkCommand ShowReportIssue { get; } =
|
||||
SparkCommand.create("Contact Support", Icons.Support, SparkTags.Support);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,8 @@ namespace mbts.spark {
|
||||
public static ITag<ITag<SecurityList>> ShowPickMultiple { get; } = new SparkTag<ITag<SecurityList>>("PickN");
|
||||
public static ITag<ITag<SecurityMD>> ShowPickOne { get; } = new SparkTag<ITag<SecurityMD>>("Pick1");
|
||||
|
||||
public static ITag<Nothing> Support { get; } = new SparkTag<Nothing>(nameof(Support));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Action
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace bts.shell
|
||||
MarketWindowFactory _mvf;
|
||||
|
||||
[ImportingConstructor]
|
||||
public MarketShellModule(IBus bus, SecuritySource ssrc, IWindowManager wm, [Import("username")]string user_name, WorkspacesModel m) {
|
||||
public MarketShellModule(IBus bus, SecuritySource ssrc, IWindowManager wm, [Import("username")]string user_name) {
|
||||
_tsf = new TimeAndSalesWindowFactory(this, bus, ssrc);
|
||||
_mvf = new MarketWindowFactory(this, bus, ssrc, wm);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
using mbts.ui;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using bts.spark;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using mbts.spark;
|
||||
using bts.api;
|
||||
using System.ComponentModel.Composition;
|
||||
using mbts.ui.shell;
|
||||
|
||||
namespace bts.ui
|
||||
{
|
||||
namespace bts.ui {
|
||||
[Export(typeof(IShellModule))]
|
||||
class SettingsShellModule : IShellModule {
|
||||
readonly IBus _bus;
|
||||
|
||||
[ImportingConstructor]
|
||||
public SettingsShellModule(IBus bus, WorkspacesModel ws) {
|
||||
// todo: Create workspaces dialog
|
||||
// todo: settings dialog
|
||||
_bus = bus;
|
||||
}
|
||||
public ImageSource icon => Icons.Admin;
|
||||
|
||||
public string name => "Settings";
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Threading.Tasks;
|
||||
using bts.api;
|
||||
using mbts.ui;
|
||||
|
||||
namespace bts.shell {
|
||||
internal class LatencyReportWindowFactory : ShellWindowFactory<LatencyReportSaveState> {
|
||||
IShellModule _owner;
|
||||
IBus _bus;
|
||||
|
||||
public LatencyReportWindowFactory(IShellModule owner, IBus bus) : base("LatencyReport") {
|
||||
_owner = owner;
|
||||
_bus = bus;
|
||||
}
|
||||
|
||||
public override Task<IShellWindow> load(LatencyReportSaveState state) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract]
|
||||
public class LatencyReportSaveState {
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,23 @@ using System.Threading.Tasks;
|
||||
using bts.spark;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using System.ComponentModel.Composition;
|
||||
using bts.api;
|
||||
using mbts.ui.shell;
|
||||
using mbts;
|
||||
|
||||
namespace bts.shell
|
||||
{
|
||||
[Export(typeof(IShellModule))]
|
||||
class SpreaderShellModule : IShellModule {
|
||||
SyntheticSpreadsShellWindowFactory _sswf;
|
||||
LatencyReportWindowFactory _lrwf;
|
||||
|
||||
[ImportingConstructor]
|
||||
public SpreaderShellModule(IBus bus) {
|
||||
_sswf = new SyntheticSpreadsShellWindowFactory(this, bus);
|
||||
_lrwf = new LatencyReportWindowFactory(this, bus);
|
||||
}
|
||||
public ImageSource icon => Icons.Cube3d;
|
||||
|
||||
public string name => "Spreader";
|
||||
@@ -23,10 +36,16 @@ namespace bts.shell
|
||||
};
|
||||
|
||||
public Task<IShellWindow> create(Stream load_stream) {
|
||||
throw new NotImplementedException();
|
||||
if (ProtoBufSerializationHelper.try_deserialize(load_stream, out ShellSerializationHeader header)) {
|
||||
if (header.name == _sswf.name) return _sswf.load_window(load_stream, header.version);
|
||||
if (header.name == _lrwf.name) return _lrwf.load_window(load_stream, header.version);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Disposable.dispose(ref _sswf);
|
||||
Disposable.dispose(ref _lrwf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Threading.Tasks;
|
||||
using bts.api;
|
||||
using mbts.ui;
|
||||
using mbts.spark;
|
||||
|
||||
namespace bts.shell {
|
||||
internal class SyntheticSpreadsShellWindowFactory : ShellWindowFactory<SyntheticSpreadsSaveState> {
|
||||
IShellModule _owner;
|
||||
IBus _bus;
|
||||
|
||||
public SyntheticSpreadsShellWindowFactory(IShellModule owner, IBus bus) : base ("SyntheticSpreads") {
|
||||
_owner = owner;
|
||||
_bus = bus;
|
||||
|
||||
// Not sure what this does
|
||||
//_dispose = bus.subscribe(SparkTags.showsyn
|
||||
}
|
||||
|
||||
public override Task<IShellWindow> load(SyntheticSpreadsSaveState state) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract]
|
||||
public class SyntheticSpreadsSaveState {
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,49 @@
|
||||
using System;
|
||||
using mbts.ui;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using bts.spark;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using bts.api;
|
||||
using mbts;
|
||||
using mbts.spark;
|
||||
|
||||
namespace bts.Modules.Support
|
||||
{
|
||||
class SupportShellModule
|
||||
{
|
||||
}
|
||||
namespace bts.Modules.Support {
|
||||
[Export(typeof(IShellModule))]
|
||||
class SupportShellModule : IShellModule {
|
||||
IDisposable _dispose;
|
||||
|
||||
[ImportingConstructor]
|
||||
public SupportShellModule(IBus bus, IBrowserWindowManager browser) {
|
||||
|
||||
_dispose = Disposable.Create(
|
||||
bus.subscribe(SparkTags.ShowUri).Subscribe(u => browser.Pages.Add(u))
|
||||
);
|
||||
}
|
||||
|
||||
public ImageSource icon => Icons.Support;
|
||||
|
||||
public string name => "Support";
|
||||
|
||||
public int priority => 50;
|
||||
|
||||
public IEnumerable<SparkCommand> actions => new[] {
|
||||
SparkCommands.ShowManual,
|
||||
SparkCommands.ShowAuditLogs,
|
||||
SparkCommands.ShowDiagnostics,
|
||||
SparkCommands.ShowReportIssue,
|
||||
SparkCommands.ShowAboutSpark
|
||||
};
|
||||
|
||||
public Task<IShellWindow> create(Stream load_stream) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ using bts.api;
|
||||
using mbts.spark;
|
||||
|
||||
namespace bts.shell {
|
||||
|
||||
[Export(typeof(IShellModule))]
|
||||
class TradingShellModule : IShellModule {
|
||||
LadderWindowFactory _lwf;
|
||||
OrderBookWindowFactory _obwf;
|
||||
@@ -30,7 +32,6 @@ namespace bts.shell {
|
||||
_order_tickets = new ShowOrderTicketHandler(bus);
|
||||
}
|
||||
|
||||
|
||||
public ImageSource icon => Icons.Trades;
|
||||
|
||||
public string name => "Trading";
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
//using bts.api;
|
||||
//using bts.spark;
|
||||
//using mbts.spark.menu_items;
|
||||
//using mbts.spark.utilities;
|
||||
//using mbts.ui;
|
||||
//using mbts.ui.spark;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.ComponentModel.Composition;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//using System.Reactive.Linq;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.Windows;
|
||||
//using System.Windows.Media;
|
||||
//using static mbts.spark.SparkBusData;
|
||||
//using static mbts.spark.SparkTags;
|
||||
//using static mbts.ui.shell.ProtoBufSerializationHelper;
|
||||
//using SecurityKey = System.UInt32;
|
||||
|
||||
//namespace mbts.spark
|
||||
//{
|
||||
// [Export(typeof(IShellModule))]
|
||||
// internal class MarketModule : IShellModule {
|
||||
// [ImportingConstructor]
|
||||
// public MarketModule(IBus bus, SecuritySource ssrc, IWindowManager wm, [Import("username")]string user_name) {
|
||||
// _bus = bus;
|
||||
// _ssrc = ssrc;
|
||||
// _wm = wm;
|
||||
// _user_name = user_name;
|
||||
// _dispose = Disposable.Create(
|
||||
// _bus.subscribe<SyntheticSecuritiesMessage>(SyntheticSecuritiesTag).ObserveOnDispatcher().Subscribe(ssm => _synthetic_strategy_map = ssm.data),
|
||||
// _bus.subscribe<ShowSpreadMatrixMessage>(ShowSpreadMatrixTag).ObserveOnDispatcher().Subscribe(show_spread_matrix),
|
||||
// _bus.subscribe<ShowOrderModifyMessage>(ShowOrderModifyTag).ObserveOnDispatcher().Subscribe(show_order_modify),
|
||||
// _bus.subscribe<ShowOrderTicketMessage>(ShowOrderTicketTag).ObserveOnDispatcher().Subscribe(show_order_ticket),
|
||||
// _bus.subscribe<ShowLinkedOrderTicketMessage>(ShowOrderTicketTag).ObserveOnDispatcher().Subscribe(show_linked_order_ticket),
|
||||
// _bus.subscribe<ShowSyntheticCreateMessage>(ShowSyntheticCreateTag).ObserveOnDispatcher().Subscribe(show_synthetic_create_editor),
|
||||
// _bus.subscribe<ShowSyntheticStrategyMessage>(ShowSyntheticStrategyTag).ObserveOnDispatcher().Subscribe(show_synthetic_strategy_editor)
|
||||
// );
|
||||
// }
|
||||
|
||||
// public IShellWindow launch_ui => new LaunchMenu {
|
||||
// DataContext = new LaunchMenuVM(
|
||||
// _ssrc,
|
||||
// new MarketViewMenuItem(_bus),
|
||||
// new SpreadMatrixMenuItem(_bus),
|
||||
// new LadderMenuItem(_bus),
|
||||
// new OrderTicketMenuItem(new DemoOrdersModel(_bus)),
|
||||
// MenuItemFactory.Create("Security Browser...", "sb", Icons.Coins, execute: show_security_browser))
|
||||
// };
|
||||
|
||||
// #region SpreadMatrix
|
||||
// private void show_spread_matrix(ShowSpreadMatrixMessage msg) { }
|
||||
// #endregion
|
||||
|
||||
// #region OrderTicket
|
||||
// private void show_order_modify(ShowOrderModifyMessage msg) { show_order_ticket(msg.data, true); }
|
||||
// private void show_order_ticket(ShowOrderTicketMessage msg) { show_order_ticket(msg.data, false); }
|
||||
// private void show_order_ticket(IReadOnlyCollection<Order> orders, bool is_modify) {
|
||||
// foreach (var o in orders) {
|
||||
// if (_securities.TryGetValue(o.Security.Id, out SecurityMD smd)) {
|
||||
// if (string.IsNullOrEmpty(o.User)) o.User = _user_name;
|
||||
// var vm = new OrderTicketVM(new DemoOrdersModel(_bus), o, _get_ladder_settings(), _bus);
|
||||
// (is_modify ? (Window)new OrderModificationDialog { DataContext = vm } : new OrderTicket { DataContext = vm }).Show(-200, -160, true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private void show_linked_order_ticket(ShowLinkedOrderTicketMessage msg) {
|
||||
// new OrderTicket {
|
||||
// DataContext = new OrderTicketVM(new DemoOrdersModel(_bus), msg.data, _get_ladder_settings(), _bus)
|
||||
// }.Show(-200, -160, true);
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region Synthentic
|
||||
// private void show_synthetic_create_editor(ShowSyntheticCreateMessage msg) {
|
||||
// var securities = msg.data;
|
||||
// if (securities.Count == 0) return;
|
||||
// Security synthetic = null;
|
||||
// ExecutionStrategy strategy = null;
|
||||
// if (securities.Count == 1) {
|
||||
// var s = securities.First();
|
||||
// synthetic = SyntheticDataHelper.Defaults.Security(find_unique_synthetic_name(), s);
|
||||
// strategy = _synthetic_strategy_map.TryGetValue(s.Id, out SyntheticExecutionStrategy ses) ? ses.ExecutionStrategy.Clone() : SyntheticDataHelper.Defaults.ExecutionStrategy(s);
|
||||
// } else {
|
||||
// synthetic = SyntheticDataHelper.Defaults.Security(find_unique_synthetic_name(), securities.Ordered(SecurityDataHelper.Comparer.Instance));
|
||||
// strategy = SyntheticDataHelper.Defaults.ExecutionStrategy(securities);
|
||||
// }
|
||||
// show_synthetic_editor(synthetic, strategy);
|
||||
// }
|
||||
// private void show_synthetic_strategy_editor(ShowSyntheticStrategyMessage msg) {
|
||||
// if (msg.data.ContractCase != Security.ContractOneofCase.Synthetic) show_synthetic_editor_warning($"{msg.data} is not a synthetic security.");
|
||||
// else if (!_synthetic_strategy_map.TryGetValue(msg.data.Id, out SyntheticExecutionStrategy ses)) {
|
||||
// string warn_msg = $"Did not find execution strategy for {msg.data}";
|
||||
// Logger.warn(bts.log.Subsystem.Ui, warn_msg);
|
||||
// show_synthetic_editor_warning(warn_msg);
|
||||
// } else show_synthetic_editor(msg.data.CloneToMutable(), ses.ExecutionStrategy);
|
||||
// }
|
||||
// private void show_synthetic_editor_warning(string warn_msg) {
|
||||
// BTSMessageBox.Show(warn_msg, "Synthetic Strategy", BTSMessageBoxButtons.OK, MessageBoxImage.Exclamation, true, false, true);
|
||||
// }
|
||||
// private void show_synthetic_editor(Security synthetic, ExecutionStrategy strategy) {
|
||||
// var dialog = new SyntheticEditorDialog { DataContext = new SyntheticEditorVM(_bus, synthetic, strategy) }.Show(-200, -300, true);
|
||||
// }
|
||||
// private string find_unique_synthetic_name() {
|
||||
// int i = 1;
|
||||
// string rv = "Synthetic{0}".fmt(i);
|
||||
// var synth_names = _securities.Values.Select(smd => smd.security).Where(s => s.ContractCase == Security.ContractOneofCase.Synthetic).Select(s => s.Synthetic.Name).ToList();
|
||||
// while (synth_names.Contains(rv)) rv = "Synthetic{0}".fmt(++i);
|
||||
// return rv;
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
||||
@@ -1,75 +0,0 @@
|
||||
//using mbts.ui;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.IO;
|
||||
//using System.Windows.Media;
|
||||
//using bts.api;
|
||||
//using System.ComponentModel.Composition;
|
||||
//using mbts.ui.spark;
|
||||
//using System.Reactive.Linq;
|
||||
//using static mbts.spark.SparkBusData;
|
||||
//using static mbts.spark.SparkTags;
|
||||
//using static mbts.ui.shell.ProtoBufSerializationHelper;
|
||||
//using mbts.spark.menu_items;
|
||||
|
||||
//namespace mbts.spark
|
||||
//{
|
||||
// [Export(typeof(IShellModule))]
|
||||
// internal class TradesModule : IShellModule
|
||||
// {
|
||||
// [ImportingConstructor]
|
||||
// public TradesModule(IBus bus, IWindowManager wm, SecuritySource ssrc) {
|
||||
// _bus = bus;
|
||||
// _ssrc = ssrc;
|
||||
// _wm = wm;
|
||||
// _dispose = Disposable.Create(
|
||||
// _bus.subscribe<ShowFillsMessage>(ShowFillsTag).ObserveOnDispatcher().Subscribe(show_fills),
|
||||
// _bus.subscribe<ShowAuditLogsMessage>(ShowAuditLogsTag).ObserveOnDispatcher().Subscribe(show_audit_log),
|
||||
// _bus.subscribe<ShowPositionsMessage>(ShowPositionsTag).ObserveOnDispatcher().Subscribe(show_positions),
|
||||
// _bus.subscribe<ShowTimeAndSalesMessage>(ShowTimeAndSalesTag).ObserveOnDispatcher().Subscribe(show_time_and_sales)
|
||||
// );
|
||||
// }
|
||||
|
||||
// private readonly IBus _bus;
|
||||
// readonly SecuritySource _ssrc;
|
||||
// private readonly IWindowManager _wm;
|
||||
// private readonly IDisposable _dispose;
|
||||
|
||||
// public int priority => 1;
|
||||
// public string name => "Trades";
|
||||
// public ImageSource icon => Icons.Trades;
|
||||
// public IShellWindow launch_ui => new LaunchMenu {
|
||||
// DataContext = new LaunchMenuVM(
|
||||
// _ssrc,
|
||||
// new OrderBookMenuItem(_bus),
|
||||
// new FillsMenuItem(_bus),
|
||||
// new AuditLogsMenuItem(_bus),
|
||||
// new PositionsMenuItem(_bus),
|
||||
// new TimeAndSalesMenuItem(_bus))
|
||||
// };
|
||||
// public void load_state(Stream state = null) { }
|
||||
// public void get_state(Stream save_here) { }
|
||||
// public Task<IShellWindow> create(Stream load_stream) {
|
||||
// var header = ProtoBuf.Serializer.DeserializeWithLengthPrefix<ShellSerializationHeader>(load_stream, ProtoBuf.PrefixStyle.Fixed32);
|
||||
// switch(header?.name) {
|
||||
// case TimeAndSalesVM.SAVE_NAME: { if (try_deserialize(load_stream, out TimeAndSalesVM.StartupData state)) return Task.FromResult<IShellWindow>(new TimeAndSalesWindow(this, _bus, state, _ssrc)); break; }
|
||||
// }
|
||||
// return Task.FromResult<IShellWindow>(null);
|
||||
// }
|
||||
// public void start() { }
|
||||
// public void Dispose() { _dispose.Dispose(); }
|
||||
|
||||
// private IShellWindow create_order_book_window(OrderBookState state) {
|
||||
// var vm = new OrderBookVM(_bus, new DemoOrdersModel(_bus), state, Observable.Return(new OrderBookSettings()));
|
||||
// var view = new OrderBookView(vm) { Width = 1526, Height = 800 };
|
||||
// return ShellWindow.create(this, "Order Book", view, vm.get_state);
|
||||
// }
|
||||
|
||||
// private void show_audit_log(ShowAuditLogsMessage msg) { }
|
||||
// private void show_positions(ShowPositionsMessage msg) { }
|
||||
// private void show_time_and_sales(ShowTimeAndSalesMessage msg) { _wm.Windows.Add(new TimeAndSalesWindow(this, _bus, msg.data, _ssrc)); }
|
||||
// }
|
||||
//}
|
||||
@@ -88,5 +88,7 @@ namespace mbts.ui
|
||||
public static ImageSource Target { get { return (DrawingImage)_resources["Target"]; } }
|
||||
public static ImageSource Tetris { get { return (DrawingImage)_resources["Tetris"]; } }
|
||||
public static ImageSource Wrench { get { return (DrawingImage)_resources["Wrench"]; } }
|
||||
|
||||
public static ImageSource Support => (DrawingImage)_resources["SupportIcon"];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user