76 lines
2.3 KiB
C#
76 lines
2.3 KiB
C#
using System;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.VisualTree;
|
|
using Project_Periodensystem.Model;
|
|
|
|
namespace Project_Periodensystem.View
|
|
{
|
|
/// <summary>
|
|
/// Code-Behind für die About-Seite
|
|
/// </summary>
|
|
public partial class AboutPage : UserControl
|
|
{
|
|
/// <summary>
|
|
/// Konstruktor
|
|
/// </summary>
|
|
public AboutPage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Zurück-Button - Navigation zur Landing Page
|
|
/// </summary>
|
|
private void BackButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var mainWindow = TopLevel.GetTopLevel(this) as Window;
|
|
if (mainWindow != null)
|
|
{
|
|
var landingPage = new LandingPage();
|
|
mainWindow.Content = landingPage;
|
|
Logger.Log("Navigation zurück zur Landing Page");
|
|
}
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
Logger.Log($"Fehler bei Navigation zurück: {ex.Message}");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event-Handler für Theme-Button - VEREINHEITLICHT mit anderen Seiten
|
|
/// </summary>
|
|
private void ThemeButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// GLEICHE LOGIK wie auf LandingPage und PeriodicTablePage
|
|
var app = Application.Current;
|
|
if (app != null)
|
|
{
|
|
var currentTheme = app.ActualThemeVariant;
|
|
app.RequestedThemeVariant = currentTheme == Avalonia.Styling.ThemeVariant.Dark
|
|
? Avalonia.Styling.ThemeVariant.Light
|
|
: Avalonia.Styling.ThemeVariant.Dark;
|
|
|
|
Logger.Log($"Theme gewechselt zu: {app.RequestedThemeVariant}");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.Log($"Fehler beim Theme-Wechsel: {ex.Message}");
|
|
}
|
|
}
|
|
}
|
|
}
|