diff --git a/src/PolyTrader.Modules.CopyTrading/CopyTradingModule.cs b/src/PolyTrader.Modules.CopyTrading/CopyTradingModule.cs index 5155931..35a21a2 100644 --- a/src/PolyTrader.Modules.CopyTrading/CopyTradingModule.cs +++ b/src/PolyTrader.Modules.CopyTrading/CopyTradingModule.cs @@ -56,54 +56,20 @@ namespace PolyTrader.Modules.CopyTrading public void RegisterUi(IModuleUiHost host, IServiceProvider services) { + // EIN Fenster fürs ganze Modul: die einzelnen Ansichten sind Tabs im + // CopyTradingMainForm (Master-Trader / geschlossene Trades / Account-Einstellungen). + // So bleibt der Launcher schlank – ein Button je Modul statt je View. host.RegisterView(new ModuleView { - Id = "copytrading.masters", - Title = "Master-Trader", + Id = "copytrading.main", + Title = "Copytrading", Group = "CopyTrading", Order = 100, CreateForm = () => { - var view = new MasterTradersView(); - view.Initialize( - services.GetRequiredService(), - services.GetRequiredService(), - services.GetRequiredService()); - return view; - } - }); - - host.RegisterView(new ModuleView - { - Id = "copytrading.closedtrades", - Title = "Geschlossene Copytrades", - Group = "CopyTrading", - Order = 110, - CreateForm = () => - { - var view = new ClosedTradesView(); - view.Initialize( - services.GetRequiredService(), - services.GetRequiredService(), - services.GetRequiredService()); - return view; - } - }); - - host.RegisterView(new ModuleView - { - Id = "copytrading.accountsettings", - Title = "Copytrading-Account-Einstellungen", - Group = "CopyTrading", - Order = 120, - CreateForm = () => - { - var view = new AccountSettingsView(); - view.Initialize( - services.GetRequiredService(), - services.GetRequiredService(), - services.GetRequiredService()); - return view; + var form = new CopyTradingMainForm(); + form.Initialize(services); + return form; } }); } diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.Designer.cs b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.Designer.cs index e33b928..d7ac45d 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.Designer.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.Designer.cs @@ -17,102 +17,108 @@ namespace PolyTrader.Modules.CopyTrading.Ui private void InitializeComponent() { - this.pnlTop = new System.Windows.Forms.Panel(); - this.cmbAccounts = new System.Windows.Forms.ComboBox(); - this.lblAccount = new System.Windows.Forms.Label(); - this.pgSettings = new System.Windows.Forms.PropertyGrid(); - this.pnlBottom = new System.Windows.Forms.Panel(); - this.lblHint = new System.Windows.Forms.Label(); - this.btnSave = new System.Windows.Forms.Button(); - this.pnlTop.SuspendLayout(); - this.pnlBottom.SuspendLayout(); - this.SuspendLayout(); - // + 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(); + // // pnlTop - // - this.pnlTop.Controls.Add(this.cmbAccounts); - this.pnlTop.Controls.Add(this.lblAccount); - this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlTop.Location = new System.Drawing.Point(0, 0); - this.pnlTop.Name = "pnlTop"; - this.pnlTop.Padding = new System.Windows.Forms.Padding(8, 8, 8, 6); - this.pnlTop.Size = new System.Drawing.Size(560, 44); - this.pnlTop.TabIndex = 0; - // + // + 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; + // // cmbAccounts - // - this.cmbAccounts.Dock = System.Windows.Forms.DockStyle.Fill; - this.cmbAccounts.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbAccounts.Location = new System.Drawing.Point(68, 8); - this.cmbAccounts.Name = "cmbAccounts"; - this.cmbAccounts.Size = new System.Drawing.Size(484, 23); - this.cmbAccounts.TabIndex = 1; - // + // + 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; + // // lblAccount - // - this.lblAccount.Dock = System.Windows.Forms.DockStyle.Left; - this.lblAccount.Location = new System.Drawing.Point(8, 8); - this.lblAccount.Name = "lblAccount"; - this.lblAccount.Size = new System.Drawing.Size(60, 30); - this.lblAccount.TabIndex = 0; - this.lblAccount.Text = "Account:"; - this.lblAccount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // + 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; + // // pgSettings - // - this.pgSettings.Dock = System.Windows.Forms.DockStyle.Fill; - this.pgSettings.Location = new System.Drawing.Point(0, 44); - this.pgSettings.Name = "pgSettings"; - this.pgSettings.PropertySort = System.Windows.Forms.PropertySort.Categorized; - this.pgSettings.Size = new System.Drawing.Size(560, 508); - this.pgSettings.TabIndex = 1; - this.pgSettings.ToolbarVisible = false; - // + // + 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; + // // pnlBottom - // - this.pnlBottom.Controls.Add(this.lblHint); - this.pnlBottom.Controls.Add(this.btnSave); - this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlBottom.Location = new System.Drawing.Point(0, 552); - this.pnlBottom.Name = "pnlBottom"; - this.pnlBottom.Padding = new System.Windows.Forms.Padding(8); - this.pnlBottom.Size = new System.Drawing.Size(560, 48); - this.pnlBottom.TabIndex = 2; - // + // + 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; + // // lblHint - // - this.lblHint.Dock = System.Windows.Forms.DockStyle.Fill; - this.lblHint.ForeColor = System.Drawing.Color.DimGray; - this.lblHint.Location = new System.Drawing.Point(8, 8); - this.lblHint.Name = "lblHint"; - this.lblHint.Size = new System.Drawing.Size(424, 32); - this.lblHint.TabIndex = 1; - this.lblHint.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // + 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 - // - this.btnSave.Dock = System.Windows.Forms.DockStyle.Right; - this.btnSave.Location = new System.Drawing.Point(432, 8); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(120, 32); - this.btnSave.TabIndex = 0; - this.btnSave.Text = "Speichern"; - this.btnSave.UseVisualStyleBackColor = true; - // + // + 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; + // // AccountSettingsView - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(560, 600); - this.Controls.Add(this.pgSettings); - this.Controls.Add(this.pnlBottom); - this.Controls.Add(this.pnlTop); - this.MinimumSize = new System.Drawing.Size(420, 400); - this.Name = "AccountSettingsView"; - this.Text = "Copytrading-Account-Einstellungen"; - this.pnlTop.ResumeLayout(false); - this.pnlBottom.ResumeLayout(false); - this.ResumeLayout(false); + // + 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); } #endregion diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.cs b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.cs index 8b87c80..13e8dae 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.cs @@ -13,7 +13,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui /// das Repo und aktualisiert den Hot-Path-State (). /// Layout im Designer (AccountSettingsView.Designer.cs), Daten/Logik hier. /// - public partial class AccountSettingsView : Form + public partial class AccountSettingsView : UserControl { private ICopyTradingAccountSettingsRepository? _repo; private TradingState? _state; diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.resx b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.resx index 1af7de1..8b2ff64 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.resx +++ b/src/PolyTrader.Modules.CopyTrading/Ui/AccountSettingsView.resx @@ -1,17 +1,17 @@  - diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.Designer.cs b/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.Designer.cs index 6d4cd88..6f1d5d7 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.Designer.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.Designer.cs @@ -203,12 +203,10 @@ namespace PolyTrader.Modules.CopyTrading.Ui // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1100, 600); this.Controls.Add(this.dgvTrades); this.Controls.Add(this.pnlTop); - this.MinimumSize = new System.Drawing.Size(700, 400); this.Name = "ClosedTradesView"; - this.Text = "Geschlossene Copytrades"; + this.Size = new System.Drawing.Size(1100, 600); this.pnlTop.ResumeLayout(false); this.pnlTop.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvTrades)).EndInit(); diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.cs b/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.cs index c5c39c1..61cdc00 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/ClosedTradesView.cs @@ -13,7 +13,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui /// aufgelösten Account-/Master-Trader-Namen und einer Kurzauswertung. /// Layout im Designer (ClosedTradesView.Designer.cs), Daten/Logik hier. /// - public partial class ClosedTradesView : Form + public partial class ClosedTradesView : UserControl { private ICopyTradeLogRepository? _tradeLog; private TradingState? _state; diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.Designer.cs b/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.Designer.cs new file mode 100644 index 0000000..a5071ca --- /dev/null +++ b/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.Designer.cs @@ -0,0 +1,129 @@ +namespace PolyTrader.Modules.CopyTrading.Ui +{ + partial class CopyTradingMainForm + { + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + private void InitializeComponent() + { + this.tabControl = new System.Windows.Forms.TabControl(); + this.tabMasters = new System.Windows.Forms.TabPage(); + this.tabClosed = new System.Windows.Forms.TabPage(); + this.tabSettings = new System.Windows.Forms.TabPage(); + this.masterTradersView = new PolyTrader.Modules.CopyTrading.Ui.MasterTradersView(); + this.closedTradesView = new PolyTrader.Modules.CopyTrading.Ui.ClosedTradesView(); + this.accountSettingsView = new PolyTrader.Modules.CopyTrading.Ui.AccountSettingsView(); + this.tabControl.SuspendLayout(); + this.tabMasters.SuspendLayout(); + this.tabClosed.SuspendLayout(); + this.tabSettings.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl + // + this.tabControl.Controls.Add(this.tabMasters); + this.tabControl.Controls.Add(this.tabClosed); + this.tabControl.Controls.Add(this.tabSettings); + this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl.Location = new System.Drawing.Point(0, 0); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(1200, 700); + this.tabControl.TabIndex = 0; + // + // tabMasters + // + this.tabMasters.Controls.Add(this.masterTradersView); + this.tabMasters.Location = new System.Drawing.Point(4, 24); + this.tabMasters.Name = "tabMasters"; + this.tabMasters.Padding = new System.Windows.Forms.Padding(3); + this.tabMasters.Size = new System.Drawing.Size(1192, 672); + this.tabMasters.TabIndex = 0; + this.tabMasters.Text = "Master-Trader"; + this.tabMasters.UseVisualStyleBackColor = true; + // + // tabClosed + // + this.tabClosed.Controls.Add(this.closedTradesView); + this.tabClosed.Location = new System.Drawing.Point(4, 24); + this.tabClosed.Name = "tabClosed"; + this.tabClosed.Padding = new System.Windows.Forms.Padding(3); + this.tabClosed.Size = new System.Drawing.Size(1192, 672); + this.tabClosed.TabIndex = 1; + this.tabClosed.Text = "Geschlossene Trades"; + this.tabClosed.UseVisualStyleBackColor = true; + // + // tabSettings + // + this.tabSettings.Controls.Add(this.accountSettingsView); + this.tabSettings.Location = new System.Drawing.Point(4, 24); + this.tabSettings.Name = "tabSettings"; + this.tabSettings.Padding = new System.Windows.Forms.Padding(3); + this.tabSettings.Size = new System.Drawing.Size(1192, 672); + this.tabSettings.TabIndex = 2; + this.tabSettings.Text = "Account-Einstellungen"; + this.tabSettings.UseVisualStyleBackColor = true; + // + // masterTradersView + // + this.masterTradersView.Dock = System.Windows.Forms.DockStyle.Fill; + this.masterTradersView.Location = new System.Drawing.Point(3, 3); + this.masterTradersView.Name = "masterTradersView"; + this.masterTradersView.Size = new System.Drawing.Size(1186, 666); + this.masterTradersView.TabIndex = 0; + // + // closedTradesView + // + this.closedTradesView.Dock = System.Windows.Forms.DockStyle.Fill; + this.closedTradesView.Location = new System.Drawing.Point(3, 3); + this.closedTradesView.Name = "closedTradesView"; + this.closedTradesView.Size = new System.Drawing.Size(1186, 666); + this.closedTradesView.TabIndex = 0; + // + // accountSettingsView + // + this.accountSettingsView.Dock = System.Windows.Forms.DockStyle.Fill; + this.accountSettingsView.Location = new System.Drawing.Point(3, 3); + this.accountSettingsView.Name = "accountSettingsView"; + this.accountSettingsView.Size = new System.Drawing.Size(1186, 666); + this.accountSettingsView.TabIndex = 0; + // + // CopyTradingMainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1200, 700); + this.Controls.Add(this.tabControl); + this.MinimumSize = new System.Drawing.Size(820, 480); + this.Name = "CopyTradingMainForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Copytrading"; + this.tabControl.ResumeLayout(false); + this.tabMasters.ResumeLayout(false); + this.tabClosed.ResumeLayout(false); + this.tabSettings.ResumeLayout(false); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage tabMasters; + private System.Windows.Forms.TabPage tabClosed; + private System.Windows.Forms.TabPage tabSettings; + private MasterTradersView masterTradersView; + private ClosedTradesView closedTradesView; + private AccountSettingsView accountSettingsView; + } +} diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.cs b/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.cs new file mode 100644 index 0000000..d6e69d0 --- /dev/null +++ b/src/PolyTrader.Modules.CopyTrading/Ui/CopyTradingMainForm.cs @@ -0,0 +1,39 @@ +using System; +using System.Windows.Forms; +using Microsoft.Extensions.DependencyInjection; +using PolyTrader.Modules.CopyTrading.Persistence; +using PolyTraderSharp; + +namespace PolyTrader.Modules.CopyTrading.Ui +{ + /// + /// Das Hauptfenster des Copytrading-Moduls. Bündelt alle Modul-Ansichten in einem + /// TabControl (Master-Trader, geschlossene Trades, Account-Einstellungen), sodass der + /// Launcher nur EINEN "Copytrading"-Button braucht und nicht je View ein eigenes Fenster + /// öffnet. Layout im Designer (CopyTradingMainForm.Designer.cs). + /// + public partial class CopyTradingMainForm : Form + { + // Parameterloser Konstruktor für den WinForms-Designer. + public CopyTradingMainForm() + { + InitializeComponent(); + } + + /// Versorgt die einzelnen Tab-Ansichten mit ihren Abhängigkeiten (aus dem DI-Container). + public void Initialize(IServiceProvider services) + { + var state = services.GetRequiredService(); + var copyState = services.GetRequiredService(); + + masterTradersView.Initialize( + services.GetRequiredService(), state, copyState); + + closedTradesView.Initialize( + services.GetRequiredService(), state, copyState); + + accountSettingsView.Initialize( + services.GetRequiredService(), state, copyState); + } + } +} diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.Designer.cs b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.Designer.cs index 30b4a01..5089098 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.Designer.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.Designer.cs @@ -258,15 +258,13 @@ namespace PolyTrader.Modules.CopyTrading.Ui // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1180, 640); this.Controls.Add(this.grid); this.Controls.Add(this.splitter); this.Controls.Add(this.rightPanel); this.Controls.Add(this.statusPanel); this.Controls.Add(this.toolbar); - this.MinimumSize = new System.Drawing.Size(820, 460); this.Name = "MasterTradersView"; - this.Text = "Master-Trader"; + this.Size = new System.Drawing.Size(1180, 640); this.toolbar.ResumeLayout(false); this.toolbar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit(); diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.cs b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.cs index 09e8350..30af4fa 100644 --- a/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.cs +++ b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.cs @@ -15,7 +15,7 @@ namespace PolyTrader.Modules.CopyTrading.Ui /// () synchron. /// Layout im Designer (MasterTradersView.Designer.cs), Daten/Logik hier. /// - public partial class MasterTradersView : Form + public partial class MasterTradersView : UserControl { private ITrackedTraderRepository? _repo; private TradingState? _state; diff --git a/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.resx b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/PolyTrader.Modules.CopyTrading/Ui/MasterTradersView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file