Phase 5-UI: JobsView extrahiert + Trading-Toggle in die Quickbar
- Neue JobsView (UserControl + Designer): DataGridView an JobManager.Jobs, Run-Now/Aktiv-Verhalten wie bisheriger Jobs-Tab. btn_jobs in toolstrip_windows, als View "core.jobs" registriert. - Trading-Toggle aus frm_main uebernommen: btn_liveTrading + btn_demoTrading in toolstrip_quickbar; Zyklus Inactive->SellOnly->Active mit Farb-/Textstatus, synchron zum TradingState (auch bei externen Aenderungen via 1s-Timer). - Build 0 Fehler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f112668147
commit
8e2a92ad2e
Generated
+129
@@ -0,0 +1,129 @@
|
||||
namespace PolyTraderSharp.Ui.Views
|
||||
{
|
||||
partial class JobsView
|
||||
{
|
||||
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.dgvJobs = new System.Windows.Forms.DataGridView();
|
||||
this.colJobName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colLastRun = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colNextRun = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.col_dgv_jobs_Enabled = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.col_dgv_jobs_Run = new System.Windows.Forms.DataGridViewButtonColumn();
|
||||
this.colDescription = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvJobs)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dgvJobs
|
||||
//
|
||||
this.dgvJobs.AllowUserToAddRows = false;
|
||||
this.dgvJobs.AllowUserToDeleteRows = false;
|
||||
this.dgvJobs.AutoGenerateColumns = false;
|
||||
this.dgvJobs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvJobs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colJobName,
|
||||
this.colStatus,
|
||||
this.colLastRun,
|
||||
this.colNextRun,
|
||||
this.col_dgv_jobs_Enabled,
|
||||
this.col_dgv_jobs_Run,
|
||||
this.colDescription});
|
||||
this.dgvJobs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgvJobs.Location = new System.Drawing.Point(0, 0);
|
||||
this.dgvJobs.Name = "dgvJobs";
|
||||
this.dgvJobs.RowHeadersVisible = false;
|
||||
this.dgvJobs.Size = new System.Drawing.Size(900, 500);
|
||||
this.dgvJobs.TabIndex = 0;
|
||||
//
|
||||
// colJobName
|
||||
//
|
||||
this.colJobName.DataPropertyName = "JobName";
|
||||
this.colJobName.HeaderText = "Job Name";
|
||||
this.colJobName.Name = "colJobName";
|
||||
this.colJobName.ReadOnly = true;
|
||||
this.colJobName.Width = 150;
|
||||
//
|
||||
// colStatus
|
||||
//
|
||||
this.colStatus.DataPropertyName = "StatusText";
|
||||
this.colStatus.HeaderText = "Status";
|
||||
this.colStatus.Name = "colStatus";
|
||||
this.colStatus.ReadOnly = true;
|
||||
this.colStatus.Width = 150;
|
||||
//
|
||||
// colLastRun
|
||||
//
|
||||
this.colLastRun.DataPropertyName = "LastRun";
|
||||
this.colLastRun.HeaderText = "Zuletzt ausgeführt";
|
||||
this.colLastRun.Name = "colLastRun";
|
||||
this.colLastRun.ReadOnly = true;
|
||||
this.colLastRun.Width = 130;
|
||||
//
|
||||
// colNextRun
|
||||
//
|
||||
this.colNextRun.DataPropertyName = "NextRun";
|
||||
this.colNextRun.HeaderText = "Nächster Lauf";
|
||||
this.colNextRun.Name = "colNextRun";
|
||||
this.colNextRun.ReadOnly = true;
|
||||
this.colNextRun.Width = 130;
|
||||
//
|
||||
// col_dgv_jobs_Enabled
|
||||
//
|
||||
this.col_dgv_jobs_Enabled.DataPropertyName = "IsEnabled";
|
||||
this.col_dgv_jobs_Enabled.HeaderText = "Aktiv";
|
||||
this.col_dgv_jobs_Enabled.Name = "col_dgv_jobs_Enabled";
|
||||
this.col_dgv_jobs_Enabled.Width = 60;
|
||||
//
|
||||
// col_dgv_jobs_Run
|
||||
//
|
||||
this.col_dgv_jobs_Run.HeaderText = "Aktion";
|
||||
this.col_dgv_jobs_Run.Name = "col_dgv_jobs_Run";
|
||||
this.col_dgv_jobs_Run.Text = "Run Now";
|
||||
this.col_dgv_jobs_Run.UseColumnTextForButtonValue = true;
|
||||
this.col_dgv_jobs_Run.Width = 90;
|
||||
//
|
||||
// colDescription
|
||||
//
|
||||
this.colDescription.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.colDescription.DataPropertyName = "Description";
|
||||
this.colDescription.HeaderText = "Beschreibung";
|
||||
this.colDescription.Name = "colDescription";
|
||||
this.colDescription.ReadOnly = true;
|
||||
//
|
||||
// JobsView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.dgvJobs);
|
||||
this.Name = "JobsView";
|
||||
this.Size = new System.Drawing.Size(900, 500);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvJobs)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dgvJobs;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colJobName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colStatus;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colLastRun;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colNextRun;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn col_dgv_jobs_Enabled;
|
||||
private System.Windows.Forms.DataGridViewButtonColumn col_dgv_jobs_Run;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colDescription;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using PolyTraderSharp.Models;
|
||||
using PolyTraderSharp.Services;
|
||||
|
||||
namespace PolyTraderSharp.Ui.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Ansicht der Hintergrund-Jobs (JobManager). Designbar (JobsView.Designer.cs).
|
||||
/// Verhalten wie der bisherige Jobs-Tab: „Run Now" löst den ManualTrigger aus,
|
||||
/// „Aktiv" schaltet den Job über die Bindung.
|
||||
/// </summary>
|
||||
public partial class JobsView : UserControl
|
||||
{
|
||||
public JobsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
colLastRun.DefaultCellStyle.Format = "HH:mm:ss";
|
||||
colNextRun.DefaultCellStyle.Format = "HH:mm:ss";
|
||||
dgvJobs.CellContentClick += DgvJobs_CellContentClick;
|
||||
}
|
||||
|
||||
public void Initialize(JobManager jobManager)
|
||||
{
|
||||
dgvJobs.DataSource = jobManager.Jobs;
|
||||
}
|
||||
|
||||
private void DgvJobs_CellContentClick(object? sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
|
||||
var dgv = (DataGridView)sender!;
|
||||
var colName = dgv.Columns[e.ColumnIndex].Name;
|
||||
|
||||
if (dgv.Rows[e.RowIndex].DataBoundItem is JobStatusRow job)
|
||||
{
|
||||
if (colName == "col_dgv_jobs_Run")
|
||||
{
|
||||
if (job.ManualTriggerAction != null)
|
||||
_ = Task.Run(() => job.ManualTriggerAction.Invoke());
|
||||
}
|
||||
else if (colName == "col_dgv_jobs_Enabled")
|
||||
{
|
||||
dgv.EndEdit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user