using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.Threading; using Deploymentcenter.Client; using Microsoft.Extensions.DependencyInjection; using PolyTrader.App.Avalonia.Shell; using PolyTrader.App.Avalonia.ViewModels; using PolyTrader.Core; using PolyTrader.Core.Analytics; using PolyTrader.Core.Configuration; using PolyTrader.Core.Modularity; using PolyTrader.Core.Persistence; using PolyTrader.Core.Security; using PolyTrader.Modules.Supervisor.Persistence; using PolyTraderSharp; using PolyTraderSharp.Models; using PolyTraderSharp.Services; namespace PolyTrader.App.Avalonia.Views { /// /// Startseite der Anwendung – Gegenstück zur bisherigen LauncherForm. Führt zu den übrigen /// Ansichten, zeigt Kernkennzahlen und beinhaltet die Live-Überblick-Widgets. /// Layout vollständig in LauncherWindow.axaml. /// /// Seit der Umstellung auf die Einfenster-Shell ist dies ein /// und kein Fenster mehr; der Klassenname bleibt vorerst, um die parallele /// Deploymentcenter-Arbeit an dieser Datei nicht mit einer Umbenennung zu kollidieren. /// Die Statusleiste (Trading/Module/API) und das Beenden liegen jetzt in /// . /// public partial class LauncherWindow : UserControl { private readonly IModuleUiHost _uiHost; private readonly IServiceProvider _services; private readonly TradingState _state; private readonly DispatcherTimer _statusTimer = new() { Interval = TimeSpan.FromSeconds(1) }; private readonly ObservableCollection _windowButtons = new(); private readonly ObservableCollection _accountRows = new(); private readonly ObservableCollection _kpiTiles = new(); private readonly ObservableCollection _notableRows = new(); private readonly ObservableCollection _alertRows = new(); private int _statusTicks; /// Ergebnis der letzten Update-Prüfung – für den Klick auf „Jetzt installieren …". private UpdateCheckResult? _updateCheck; public LauncherWindow() => AvaloniaXamlLoader.Load(this); public LauncherWindow(IModuleUiHost uiHost, IServiceProvider services) : this() { _uiHost = uiHost; _services = services; _state = services.GetRequiredService(); this.FindControl("windowButtons")!.ItemsSource = _windowButtons; this.FindControl("gridAccounts")!.ItemsSource = _accountRows; this.FindControl("kpiTiles")!.ItemsSource = _kpiTiles; this.FindControl("gridNotable")!.ItemsSource = _notableRows; this.FindControl("gridAlerts")!.ItemsSource = _alertRows; RebuildWindowButtons(); _uiHost.OpenStateChanged += OnOpenStateChanged; this.FindControl