From e4aa132c79fd19f00d2084913bc77d0c61affdf3 Mon Sep 17 00:00:00 2001 From: OliverT87 Date: Fri, 27 Jun 2025 09:25:16 +0200 Subject: [PATCH] implemented highlighting of the grid via button. --- .../MainWindow.axaml.cs | 2 +- .../NavigationService.cs | 40 ++++- .../PeriodicTablePage.axaml | 95 +++++++--- .../PeriodicTablePage.axaml.cs | 166 ++++++++++++++++++ projektstruktur.txt | Bin 34976 -> 0 bytes 5 files changed, 265 insertions(+), 38 deletions(-) delete mode 100644 projektstruktur.txt diff --git a/Project_Periodensystem.View/MainWindow.axaml.cs b/Project_Periodensystem.View/MainWindow.axaml.cs index 1a91175..491bb3f 100644 --- a/Project_Periodensystem.View/MainWindow.axaml.cs +++ b/Project_Periodensystem.View/MainWindow.axaml.cs @@ -19,7 +19,7 @@ namespace Project_Periodensystem.View InitializeComponent(); mainContent = this.FindControl("MainContent"); - // Erstelle Navigation Service + // Erstelle Navigation Service mit this (MainWindow) _navigationService = new NavigationService(this); // Controller mit Navigation Service initialisieren (Dependency Injection) diff --git a/Project_Periodensystem.View/NavigationService.cs b/Project_Periodensystem.View/NavigationService.cs index 7913699..1f06609 100644 --- a/Project_Periodensystem.View/NavigationService.cs +++ b/Project_Periodensystem.View/NavigationService.cs @@ -14,13 +14,13 @@ namespace Project_Periodensystem.View /// public class NavigationService : INavigationService { - private readonly Window _mainWindow; + private readonly MainWindow _mainWindow; private PeriodensystemController? _dataController; /// /// Konstruktor /// - public NavigationService(Window mainWindow) + public NavigationService(MainWindow mainWindow) { _mainWindow = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow)); Logger.Log("NavigationService initialisiert - saubere Interface-Trennung"); @@ -50,8 +50,16 @@ namespace Project_Periodensystem.View var periodicTablePage = new PeriodicTablePage(); periodicTablePage.SetController(_dataController); - _mainWindow.Content = periodicTablePage; - Logger.Log("NavigationService: Navigation zum Periodensystem"); + var mainContent = _mainWindow.FindControl("MainContent"); + if (mainContent != null) + { + mainContent.Content = periodicTablePage; + Logger.Log("NavigationService: Navigation zum Periodensystem"); + } + else + { + Logger.LogError("MainContent Control nicht gefunden"); + } } catch (Exception ex) { @@ -75,8 +83,16 @@ namespace Project_Periodensystem.View var aboutPage = new AboutPage(); aboutPage.SetController(_dataController); - _mainWindow.Content = aboutPage; - Logger.Log("NavigationService: Navigation zu About"); + var mainContent = _mainWindow.FindControl("MainContent"); + if (mainContent != null) + { + mainContent.Content = aboutPage; + Logger.Log("NavigationService: Navigation zu About"); + } + else + { + Logger.LogError("MainContent Control nicht gefunden"); + } } catch (Exception ex) { @@ -100,8 +116,16 @@ namespace Project_Periodensystem.View var landingPage = new LandingPage(); landingPage.SetController(_dataController); - _mainWindow.Content = landingPage; - Logger.Log("NavigationService: Navigation zur Landing Page"); + var mainContent = _mainWindow.FindControl("MainContent"); + if (mainContent != null) + { + mainContent.Content = landingPage; + Logger.Log("NavigationService: Navigation zur Landing Page"); + } + else + { + Logger.LogError("MainContent Control nicht gefunden"); + } } catch (Exception ex) { diff --git a/Project_Periodensystem.View/PeriodicTablePage.axaml b/Project_Periodensystem.View/PeriodicTablePage.axaml index 898c8d1..92df79c 100644 --- a/Project_Periodensystem.View/PeriodicTablePage.axaml +++ b/Project_Periodensystem.View/PeriodicTablePage.axaml @@ -43,6 +43,12 @@ + + + + + + + + + + + + @@ -100,47 +132,52 @@ - + - - - - + +