Copytrading-Tabs: ToolStrips in ClosedTrades + AccountSettings

Konsistent zum Master-Trader-Tab bekommen die beiden anderen Tabs eine ToolStrip
mit ihren Aktions-Buttons:
- ClosedTradesView: ToolStrip mit "Aktualisieren"; Kurzauswertung wandert in eine
  untere Statusleiste (lblSummary).
- AccountSettingsView: ToolStrip mit Account-Auswahl (ToolStripComboBox) +
  "Speichern"; Hinweistext in untere Statusleiste (lblHint).
- Beide bleiben Designer-basiert (Size statt ClientSize, da UserControl).

Hinweis: Separate Einzelview-Registrierungen existieren nicht mehr (bereits in
c3d7e41 auf die eine View copytrading.main konsolidiert); die drei UserControls
sind ausschliesslich Tab-Inhalte.

Verifiziert: Build gruen, --smoke-ui gruen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-06 11:13:48 +02:00
co-authored by Claude Opus 4.8
parent c3d7e41e62
commit e27a659529
5 changed files with 274 additions and 147 deletions
@@ -17,118 +17,110 @@ namespace PolyTrader.Modules.CopyTrading.Ui
private void InitializeComponent()
{
pnlTop = new Panel();
cmbAccounts = new ComboBox();
lblAccount = new Label();
pgSettings = new PropertyGrid();
pnlBottom = new Panel();
lblHint = new Label();
btnSave = new Button();
pnlTop.SuspendLayout();
pnlBottom.SuspendLayout();
SuspendLayout();
this.toolbar = new System.Windows.Forms.ToolStrip();
this.tsAccountLabel = new System.Windows.Forms.ToolStripLabel();
this.tsAccounts = new System.Windows.Forms.ToolStripComboBox();
this.tsSep = new System.Windows.Forms.ToolStripSeparator();
this.tsSave = new System.Windows.Forms.ToolStripButton();
this.pgSettings = new System.Windows.Forms.PropertyGrid();
this.statusPanel = new System.Windows.Forms.Panel();
this.lblHint = new System.Windows.Forms.Label();
this.toolbar.SuspendLayout();
this.statusPanel.SuspendLayout();
this.SuspendLayout();
//
// pnlTop
// toolbar
//
pnlTop.Controls.Add(cmbAccounts);
pnlTop.Controls.Add(lblAccount);
pnlTop.Dock = DockStyle.Top;
pnlTop.Location = new Point(0, 0);
pnlTop.Margin = new Padding(4, 5, 4, 5);
pnlTop.Name = "pnlTop";
pnlTop.Padding = new Padding(11, 13, 11, 10);
pnlTop.Size = new Size(800, 73);
pnlTop.TabIndex = 0;
this.toolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsAccountLabel,
this.tsAccounts,
this.tsSep,
this.tsSave});
this.toolbar.Location = new System.Drawing.Point(0, 0);
this.toolbar.Name = "toolbar";
this.toolbar.Size = new System.Drawing.Size(560, 25);
this.toolbar.TabIndex = 0;
//
// cmbAccounts
// tsAccountLabel
//
cmbAccounts.Dock = DockStyle.Fill;
cmbAccounts.DropDownStyle = ComboBoxStyle.DropDownList;
cmbAccounts.Location = new Point(97, 13);
cmbAccounts.Margin = new Padding(4, 5, 4, 5);
cmbAccounts.Name = "cmbAccounts";
cmbAccounts.Size = new Size(692, 33);
cmbAccounts.TabIndex = 1;
this.tsAccountLabel.Name = "tsAccountLabel";
this.tsAccountLabel.Size = new System.Drawing.Size(56, 22);
this.tsAccountLabel.Text = "Account:";
//
// lblAccount
// tsAccounts
//
lblAccount.Dock = DockStyle.Left;
lblAccount.Location = new Point(11, 13);
lblAccount.Margin = new Padding(4, 0, 4, 0);
lblAccount.Name = "lblAccount";
lblAccount.Size = new Size(86, 50);
lblAccount.TabIndex = 0;
lblAccount.Text = "Account:";
lblAccount.TextAlign = ContentAlignment.MiddleLeft;
this.tsAccounts.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tsAccounts.Name = "tsAccounts";
this.tsAccounts.Size = new System.Drawing.Size(320, 25);
//
// tsSep
//
this.tsSep.Name = "tsSep";
this.tsSep.Size = new System.Drawing.Size(6, 25);
//
// tsSave
//
this.tsSave.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsSave.Name = "tsSave";
this.tsSave.Size = new System.Drawing.Size(69, 22);
this.tsSave.Text = "Speichern";
//
// pgSettings
//
pgSettings.Dock = DockStyle.Fill;
pgSettings.Location = new Point(0, 73);
pgSettings.Margin = new Padding(4, 5, 4, 5);
pgSettings.Name = "pgSettings";
pgSettings.PropertySort = PropertySort.Categorized;
pgSettings.Size = new Size(800, 847);
pgSettings.TabIndex = 1;
pgSettings.ToolbarVisible = false;
this.pgSettings.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgSettings.Location = new System.Drawing.Point(0, 25);
this.pgSettings.Name = "pgSettings";
this.pgSettings.PropertySort = System.Windows.Forms.PropertySort.Categorized;
this.pgSettings.Size = new System.Drawing.Size(560, 549);
this.pgSettings.TabIndex = 1;
this.pgSettings.ToolbarVisible = false;
//
// pnlBottom
// statusPanel
//
pnlBottom.Controls.Add(lblHint);
pnlBottom.Controls.Add(btnSave);
pnlBottom.Dock = DockStyle.Bottom;
pnlBottom.Location = new Point(0, 920);
pnlBottom.Margin = new Padding(4, 5, 4, 5);
pnlBottom.Name = "pnlBottom";
pnlBottom.Padding = new Padding(11, 13, 11, 13);
pnlBottom.Size = new Size(800, 80);
pnlBottom.TabIndex = 2;
this.statusPanel.Controls.Add(this.lblHint);
this.statusPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.statusPanel.Location = new System.Drawing.Point(0, 574);
this.statusPanel.Name = "statusPanel";
this.statusPanel.Size = new System.Drawing.Size(560, 26);
this.statusPanel.TabIndex = 2;
//
// lblHint
//
lblHint.Dock = DockStyle.Fill;
lblHint.ForeColor = Color.DimGray;
lblHint.Location = new Point(11, 13);
lblHint.Margin = new Padding(4, 0, 4, 0);
lblHint.Name = "lblHint";
lblHint.Size = new Size(607, 54);
lblHint.TabIndex = 1;
lblHint.TextAlign = ContentAlignment.MiddleLeft;
//
// btnSave
//
btnSave.Dock = DockStyle.Right;
btnSave.Location = new Point(618, 13);
btnSave.Margin = new Padding(4, 5, 4, 5);
btnSave.Name = "btnSave";
btnSave.Size = new Size(171, 54);
btnSave.TabIndex = 0;
btnSave.Text = "Speichern";
btnSave.UseVisualStyleBackColor = true;
this.lblHint.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblHint.ForeColor = System.Drawing.Color.DimGray;
this.lblHint.Location = new System.Drawing.Point(0, 0);
this.lblHint.Name = "lblHint";
this.lblHint.Padding = new System.Windows.Forms.Padding(8, 0, 0, 0);
this.lblHint.Size = new System.Drawing.Size(560, 26);
this.lblHint.TabIndex = 0;
this.lblHint.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// AccountSettingsView
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(pgSettings);
Controls.Add(pnlBottom);
Controls.Add(pnlTop);
Margin = new Padding(4, 5, 4, 5);
Name = "AccountSettingsView";
Size = new Size(800, 1000);
pnlTop.ResumeLayout(false);
pnlBottom.ResumeLayout(false);
ResumeLayout(false);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pgSettings);
this.Controls.Add(this.statusPanel);
this.Controls.Add(this.toolbar);
this.Name = "AccountSettingsView";
this.Size = new System.Drawing.Size(560, 600);
this.toolbar.ResumeLayout(false);
this.toolbar.PerformLayout();
this.statusPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.ComboBox cmbAccounts;
private System.Windows.Forms.Label lblAccount;
private System.Windows.Forms.ToolStrip toolbar;
private System.Windows.Forms.ToolStripLabel tsAccountLabel;
private System.Windows.Forms.ToolStripComboBox tsAccounts;
private System.Windows.Forms.ToolStripSeparator tsSep;
private System.Windows.Forms.ToolStripButton tsSave;
private System.Windows.Forms.PropertyGrid pgSettings;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel statusPanel;
private System.Windows.Forms.Label lblHint;
private System.Windows.Forms.Button btnSave;
}
}
@@ -26,8 +26,8 @@ namespace PolyTrader.Modules.CopyTrading.Ui
{
InitializeComponent();
cmbAccounts.SelectedIndexChanged += (_, _) => LoadSelected();
btnSave.Click += (_, _) => Save();
tsAccounts.SelectedIndexChanged += (_, _) => LoadSelected();
tsSave.Click += (_, _) => Save();
}
/// <summary>Injiziert die Abhängigkeiten (nach der DI-Auflösung) und füllt die Auswahl.</summary>
@@ -48,9 +48,9 @@ namespace PolyTrader.Modules.CopyTrading.Ui
.Select(a => new AccountItem(a.AccountId, string.IsNullOrEmpty(a.Name) ? $"#{a.AccountId}" : $"{a.Name} (#{a.AccountId}){(a.IsDemo ? " · Demo" : "")}"))
.ToList();
cmbAccounts.DisplayMember = nameof(AccountItem.Label);
cmbAccounts.ValueMember = nameof(AccountItem.Id);
cmbAccounts.DataSource = items;
tsAccounts.ComboBox.DisplayMember = nameof(AccountItem.Label);
tsAccounts.ComboBox.ValueMember = nameof(AccountItem.Id);
tsAccounts.ComboBox.DataSource = items;
if (items.Count > 0) LoadSelected();
else lblHint.Text = "Keine Accounts vorhanden.";
@@ -58,7 +58,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui
private void LoadSelected()
{
if (_repo == null || cmbAccounts.SelectedItem is not AccountItem item) return;
if (_repo == null || tsAccounts.SelectedItem is not AccountItem item) return;
_current = _repo.Get(item.Id) ?? new CopyTradingAccountSettings { AccountId = item.Id };
pgSettings.SelectedObject = _current;
lblHint.Text = $"Einstellungen für Account #{item.Id}.";
@@ -17,9 +17,8 @@ namespace PolyTrader.Modules.CopyTrading.Ui
private void InitializeComponent()
{
this.pnlTop = new System.Windows.Forms.Panel();
this.lblSummary = new System.Windows.Forms.Label();
this.btnRefresh = new System.Windows.Forms.Button();
this.toolbar = new System.Windows.Forms.ToolStrip();
this.tsRefresh = new System.Windows.Forms.ToolStripButton();
this.dgvTrades = new System.Windows.Forms.DataGridView();
this.colTradeId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -34,37 +33,29 @@ namespace PolyTrader.Modules.CopyTrading.Ui
this.colPnlPct = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpenedAt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colClosedAt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pnlTop.SuspendLayout();
this.statusPanel = new System.Windows.Forms.Panel();
this.lblSummary = new System.Windows.Forms.Label();
this.toolbar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvTrades)).BeginInit();
this.statusPanel.SuspendLayout();
this.SuspendLayout();
//
// pnlTop
// toolbar
//
this.pnlTop.Controls.Add(this.lblSummary);
this.pnlTop.Controls.Add(this.btnRefresh);
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(0, 0);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(1100, 40);
this.pnlTop.TabIndex = 0;
this.toolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsRefresh});
this.toolbar.Location = new System.Drawing.Point(0, 0);
this.toolbar.Name = "toolbar";
this.toolbar.Size = new System.Drawing.Size(1100, 25);
this.toolbar.TabIndex = 0;
//
// lblSummary
// tsRefresh
//
this.lblSummary.AutoSize = true;
this.lblSummary.Location = new System.Drawing.Point(148, 12);
this.lblSummary.Name = "lblSummary";
this.lblSummary.Size = new System.Drawing.Size(16, 15);
this.lblSummary.TabIndex = 1;
this.lblSummary.Text = "—";
//
// btnRefresh
//
this.btnRefresh.Location = new System.Drawing.Point(8, 6);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(130, 28);
this.btnRefresh.TabIndex = 0;
this.btnRefresh.Text = "Aktualisieren";
this.btnRefresh.UseVisualStyleBackColor = true;
this.tsRefresh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsRefresh.Name = "tsRefresh";
this.tsRefresh.Size = new System.Drawing.Size(90, 22);
this.tsRefresh.Text = "Aktualisieren";
//
// dgvTrades
//
@@ -87,12 +78,12 @@ namespace PolyTrader.Modules.CopyTrading.Ui
this.colOpenedAt,
this.colClosedAt});
this.dgvTrades.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvTrades.Location = new System.Drawing.Point(0, 40);
this.dgvTrades.Location = new System.Drawing.Point(0, 25);
this.dgvTrades.Name = "dgvTrades";
this.dgvTrades.ReadOnly = true;
this.dgvTrades.RowHeadersVisible = false;
this.dgvTrades.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvTrades.Size = new System.Drawing.Size(1100, 560);
this.dgvTrades.Size = new System.Drawing.Size(1100, 549);
this.dgvTrades.TabIndex = 1;
//
// colTradeId
@@ -199,25 +190,47 @@ namespace PolyTrader.Modules.CopyTrading.Ui
this.colClosedAt.ReadOnly = true;
this.colClosedAt.Width = 130;
//
// statusPanel
//
this.statusPanel.Controls.Add(this.lblSummary);
this.statusPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.statusPanel.Location = new System.Drawing.Point(0, 574);
this.statusPanel.Name = "statusPanel";
this.statusPanel.Size = new System.Drawing.Size(1100, 26);
this.statusPanel.TabIndex = 2;
//
// lblSummary
//
this.lblSummary.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblSummary.Location = new System.Drawing.Point(0, 0);
this.lblSummary.Name = "lblSummary";
this.lblSummary.Padding = new System.Windows.Forms.Padding(8, 0, 0, 0);
this.lblSummary.Size = new System.Drawing.Size(1100, 26);
this.lblSummary.TabIndex = 0;
this.lblSummary.Text = "—";
this.lblSummary.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ClosedTradesView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.dgvTrades);
this.Controls.Add(this.pnlTop);
this.Controls.Add(this.statusPanel);
this.Controls.Add(this.toolbar);
this.Name = "ClosedTradesView";
this.Size = new System.Drawing.Size(1100, 600);
this.pnlTop.ResumeLayout(false);
this.pnlTop.PerformLayout();
this.toolbar.ResumeLayout(false);
this.toolbar.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvTrades)).EndInit();
this.statusPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.Label lblSummary;
private System.Windows.Forms.ToolStrip toolbar;
private System.Windows.Forms.ToolStripButton tsRefresh;
private System.Windows.Forms.DataGridView dgvTrades;
private System.Windows.Forms.DataGridViewTextBoxColumn colTradeId;
private System.Windows.Forms.DataGridViewTextBoxColumn colAccount;
@@ -232,5 +245,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui
private System.Windows.Forms.DataGridViewTextBoxColumn colPnlPct;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpenedAt;
private System.Windows.Forms.DataGridViewTextBoxColumn colClosedAt;
private System.Windows.Forms.Panel statusPanel;
private System.Windows.Forms.Label lblSummary;
}
}
@@ -32,7 +32,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui
colOpenedAt.DefaultCellStyle.Format = "dd.MM.yyyy HH:mm";
colClosedAt.DefaultCellStyle.Format = "dd.MM.yyyy HH:mm";
btnRefresh.Click += (_, _) => LoadData();
tsRefresh.Click += (_, _) => LoadData();
}
/// <summary>Injiziert die Abhängigkeiten (nach der DI-Auflösung) und lädt die Daten.</summary>
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>