Files
IBKRTrader/Core/Workers/WorkerInfo.cs
T
RichardandClaude Opus 4.8 ebeb035e92 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>
2026-07-26 18:19:47 +02:00

59 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}