@
Launcher: ToolStrip-Fensterleiste + Icons (aus PolytraderSharp) - Fenster-Buttons in einem ToolStrip (Icon ueber Text, 32x32) statt Einzel-Buttons - 24 Icon-PNGs aus PolytraderSharp uebernommen (Resources/) + Properties/Resources.resx (ResXFileRef) + Resources.Designer.cs - Program.AssignViewIcons: Icons je View-ID zugewiesen (Workers=system_time, Logs=error_log, Settings=setting_tools, CongressTrading=cross_reference); Icons auch im Fenster-Menue - Button-Checked spiegelt Offen-Status - Build + 30/30 Tests + smoke-ui gruen; Screenshot geprueft Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
This commit is contained in:
+30
-13
@@ -21,11 +21,7 @@ public sealed class LauncherForm : Form
|
||||
private readonly WorkerEngine _workerEngine;
|
||||
private readonly IReadOnlyList<IModule> _modules;
|
||||
|
||||
private readonly Dictionary<string, Button> _viewButtons = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly FlowLayoutPanel _buttonPanel = new()
|
||||
{
|
||||
Dock = DockStyle.Fill, Padding = new Padding(16), AutoScroll = true
|
||||
};
|
||||
private readonly Dictionary<string, ToolStripButton> _viewButtons = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly ToolStripStatusLabel _status = new("Start...");
|
||||
|
||||
public LauncherForm(ShellUiHost uiHost, IServiceProvider services)
|
||||
@@ -52,26 +48,47 @@ public sealed class LauncherForm : Form
|
||||
var menu = new MenuStrip { Dock = DockStyle.Top, ImageScalingSize = new Size(24, 24) };
|
||||
WindowMenu.Wire(menu, _uiHost, null);
|
||||
|
||||
// Fenster-Buttons in einem ToolStrip (Icon über Text) – wie im PolytraderSharp-Launcher.
|
||||
var toolstrip = new ToolStrip
|
||||
{
|
||||
Dock = DockStyle.Top,
|
||||
GripStyle = ToolStripGripStyle.Hidden,
|
||||
ImageScalingSize = new Size(32, 32),
|
||||
AutoSize = true,
|
||||
Padding = new Padding(4)
|
||||
};
|
||||
|
||||
foreach (var view in _uiHost.Views.OrderBy(v => v.Order).ThenBy(v => v.Title))
|
||||
{
|
||||
var id = view.Id;
|
||||
var btn = new Button
|
||||
var btn = new ToolStripButton(view.Title, view.Icon)
|
||||
{
|
||||
Text = view.Title, Width = 210, Height = 48, Margin = new Padding(8),
|
||||
TextAlign = ContentAlignment.MiddleLeft, Image = view.Icon,
|
||||
ImageAlign = ContentAlignment.MiddleLeft, TextImageRelation = TextImageRelation.ImageBeforeText
|
||||
DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
|
||||
ImageScaling = ToolStripItemImageScaling.None,
|
||||
TextImageRelation = TextImageRelation.ImageAboveText,
|
||||
AutoSize = true,
|
||||
Padding = new Padding(6, 2, 6, 2)
|
||||
};
|
||||
btn.Click += (_, _) => _uiHost.OpenView(id);
|
||||
_viewButtons[id] = btn;
|
||||
_buttonPanel.Controls.Add(btn);
|
||||
toolstrip.Items.Add(btn);
|
||||
}
|
||||
|
||||
var content = new Panel { Dock = DockStyle.Fill, BackColor = SystemColors.ControlLightLight };
|
||||
content.Controls.Add(new Label
|
||||
{
|
||||
Text = "IBKRTrader — Launcher\nFenster über die Leiste oben öffnen.",
|
||||
Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleCenter,
|
||||
ForeColor = SystemColors.GrayText, Font = new Font(Font.FontFamily, 11f)
|
||||
});
|
||||
|
||||
var statusStrip = new StatusStrip();
|
||||
statusStrip.Items.Add(_status);
|
||||
|
||||
// Reihenfolge: Fill-Panel zuerst, dann Bottom, dann Top (WinForms Dock-Stacking).
|
||||
Controls.Add(_buttonPanel);
|
||||
// Dock-Stacking: zuletzt hinzugefügtes Top-Control liegt oben → Menü über ToolStrip.
|
||||
Controls.Add(content);
|
||||
Controls.Add(statusStrip);
|
||||
Controls.Add(toolstrip);
|
||||
Controls.Add(menu);
|
||||
MainMenuStrip = menu;
|
||||
}
|
||||
@@ -143,7 +160,7 @@ public sealed class LauncherForm : Form
|
||||
if (IsDisposed) return;
|
||||
if (InvokeRequired) { BeginInvoke((Action)UpdateButtonStates); return; }
|
||||
foreach (var (id, btn) in _viewButtons)
|
||||
btn.Font = new Font(btn.Font, _uiHost.IsOpen(id) ? FontStyle.Bold : FontStyle.Regular);
|
||||
btn.Checked = _uiHost.IsOpen(id);
|
||||
}
|
||||
|
||||
private void SetStatus(string text)
|
||||
|
||||
Reference in New Issue
Block a user