using System; using System.Collections.ObjectModel; using System.Linq; using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Threading; using Microsoft.Extensions.DependencyInjection; using PolyTrader.App.Avalonia.Shell; using PolyTrader.Core.Modularity; using PolyTraderSharp; namespace PolyTrader.App.Avalonia.Views { /// /// „Startleiste" der Anwendung – Gegenstück zur bisherigen LauncherForm. Öffnet die Fenster, /// spiegelt deren Offen-Status und zeigt die Kernkennzahlen in der Statusleiste. /// Layout vollständig in LauncherWindow.axaml. /// public partial class LauncherWindow : Window { private readonly AvaloniaUiHost _uiHost; private readonly IServiceProvider _services; private readonly TradingState _state; private readonly DispatcherTimer _statusTimer = new() { Interval = TimeSpan.FromSeconds(1) }; private readonly ObservableCollection _windowButtons = new(); public LauncherWindow() => AvaloniaXamlLoader.Load(this); public LauncherWindow(AvaloniaUiHost uiHost, IServiceProvider services) : this() { _uiHost = uiHost; _services = services; _state = services.GetRequiredService(); // currentViewId == null => dies ist der Launcher (rechte Menueaktion "Beenden"). this.FindControl("menuBar")!.Attach(uiHost, null, this); this.FindControl("windowButtons")!.ItemsSource = _windowButtons; RebuildWindowButtons(); _uiHost.OpenStateChanged += OnOpenStateChanged; this.FindControl