44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using AquaCare.Controller;
|
|
using AquaCare.Persistence;
|
|
using System;
|
|
|
|
namespace AquaCare.View
|
|
{
|
|
public partial class WerteWindow : Window
|
|
{
|
|
private readonly WerteController _controller;
|
|
|
|
public WerteWindow()
|
|
{
|
|
InitializeComponent();
|
|
_controller = new WerteController(new Datenbank());
|
|
LoadData();
|
|
}
|
|
|
|
private void LoadData()
|
|
{
|
|
var werte = _controller.LoadWerte();
|
|
WerteDataGrid.ItemsSource = werte; // Bindet die Werte an das DataGrid
|
|
}
|
|
|
|
private void CloseWindowClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
// Direkte Benutzerinteraktion ohne MessageBox
|
|
Console.WriteLine("Möchten Sie das Fenster wirklich schließen? (Ja/Nein)");
|
|
|
|
// Simuliere eine Benutzeraktion (z. B. durch eine UI-Komponente oder Konsoleninteraktion)
|
|
bool userConfirmed = true; // Setze dies basierend auf der Benutzeraktion
|
|
|
|
if (userConfirmed)
|
|
{
|
|
this.Close(); // Fenster schließen
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Schließen des Fensters abgebrochen.");
|
|
}
|
|
}
|
|
}
|
|
} |