Projekt_SS25/Project_Periodensystem.View/MainWindow.axaml.cs

66 lines
1.7 KiB
C#

using Avalonia;
using Avalonia.Controls;
using Project_Periodensystem.Model;
namespace Project_Periodensystem.View
{
/// <summary>
/// Vereinfachtes MainWindow - nur noch Container für Content
/// </summary>
public partial class MainWindow : Window
{
private ContentControl? mainContent;
public MainWindow()
{
InitializeComponent();
mainContent = this.FindControl<ContentControl>("MainContent");
ShowLandingPage();
}
/// <summary>
/// Zeigt die Landing Page an
/// </summary>
public void ShowLandingPage()
{
if (mainContent != null)
{
mainContent.Content = new LandingPage();
Logger.Log("Landing Page angezeigt");
}
}
/// <summary>
/// Zeigt das Periodensystem an
/// </summary>
public void ShowPeriodicTable()
{
Logger.Log("ShowPeriodicTable called");
try
{
if (mainContent != null)
{
mainContent.Content = new PeriodicTablePage();
Logger.Log("PeriodicTablePage created and set");
}
}
catch (System.Exception ex)
{
Logger.Log($"Error in ShowPeriodicTable: {ex.Message}");
}
}
/// <summary>
/// Zeigt die About Page an
/// </summary>
public void ShowAboutPage()
{
if (mainContent != null)
{
mainContent.Content = new AboutPage();
Logger.Log("About Page angezeigt");
}
}
}
}