using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.VisualTree; using Project_Periodensystem.Model; using System; using System.Collections.Generic; namespace Project_Periodensystem.View { public partial class LandingPage : UserControl { private readonly Random random = new(); private readonly Dictionary themeColors; private DateTime lastClickTime = DateTime.MinValue; private const int DEBOUNCE_MS = 500; public LandingPage() { Logger.Log($"=== LandingPage wird initialisiert am {DateTime.Now:dd.MM.yyyy HH:mm:ss} ==="); InitializeComponent(); themeColors = new Dictionary { { AppTheme.Dark, "#5C5144" }, { AppTheme.Light, "#E8DFD8" }, { AppTheme.Classic, "#7B8B6F" } }; Logger.Log("LandingPage initialisiert"); } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } private void ThemeButton_Click(object? sender, RoutedEventArgs e) { var themes = Enum.GetValues(); MainWindow.CurrentTheme = themes[(Array.IndexOf(themes, MainWindow.CurrentTheme) + 1) % themes.Length]; if (MainWindow.Instance != null) { MainWindow.Instance.UpdateTheme(MainWindow.CurrentTheme); } } private void StartButton_Click(object? sender, RoutedEventArgs e) { // Add multiple ways to see if this method is called System.Diagnostics.Debug.WriteLine("StartButton_Click CALLED!"); Console.WriteLine("StartButton_Click CALLED!"); // Remove the MessageBox line - it's not available Logger.Log("=== StartButton_Click CALLED ==="); try { if (MainWindow.Instance != null) { Logger.Log("Found MainWindow instance - calling ShowPeriodicTable"); MainWindow.Instance.ShowPeriodicTable(); Logger.Log("ShowPeriodicTable called successfully"); } else { Logger.Log("MainWindow.Instance is null!"); } } catch (Exception ex) { Logger.Log($"ERROR in StartButton_Click: {ex.Message}"); } } } }