Initial commit: IBKRTrader
.NET WinForms-Anwendung (Core, Modules/CongressTrading, UI). Enthaelt .gitignore und settings.example.json als Konfigurationsvorlage. Echte settings.json mit Zugangsdaten ist bewusst ausgeschlossen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace IBKRTrader.Core.Workers;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel-Objekt für eine Zeile in dgv_workerlist.
|
||||
/// Implementiert INotifyPropertyChanged für automatisches DataGridView-Binding.
|
||||
/// </summary>
|
||||
public class WorkerInfo : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
private bool _active;
|
||||
private string _type = "";
|
||||
private string _module = "";
|
||||
private string _workerName = "";
|
||||
private DateTime? _lastRuntime;
|
||||
private DateTime? _nextRuntime;
|
||||
private string _runEvery = "";
|
||||
private string _info = "";
|
||||
private WorkerStatus _status = WorkerStatus.Idle;
|
||||
|
||||
// ─── Properties ───────────────────────────────────────────────────────────
|
||||
|
||||
public bool Active { get => _active; set => Set(ref _active, value); }
|
||||
public string Type { get => _type; set => Set(ref _type, value); }
|
||||
public string Module { get => _module; set => Set(ref _module, value); }
|
||||
public string WorkerName { get => _workerName; set => Set(ref _workerName, value); }
|
||||
public DateTime? LastRuntime { get => _lastRuntime; set => Set(ref _lastRuntime, value); }
|
||||
public DateTime? NextRuntime { get => _nextRuntime; set => Set(ref _nextRuntime, value); }
|
||||
public string RunEvery { get => _runEvery; set => Set(ref _runEvery, value); }
|
||||
public string Info { get => _info; set => Set(ref _info, value); }
|
||||
|
||||
/// <summary>Interner Status – wird nicht direkt als DGV-Spalte verwendet,
|
||||
/// aber steuert die Info-Spalte.</summary>
|
||||
public WorkerStatus Status
|
||||
{
|
||||
get => _status;
|
||||
set
|
||||
{
|
||||
if (!Set(ref _status, value)) return;
|
||||
// Info-Text automatisch synchronisieren
|
||||
if (value == WorkerStatus.Idle && string.IsNullOrWhiteSpace(_info))
|
||||
Info = "Bereit";
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Hilfsmethode ─────────────────────────────────────────────────────────
|
||||
|
||||
private bool Set<T>(ref T field, T value, [CallerMemberName] string? prop = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
||||
field = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(prop));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user