AquaCare/AquaCare.View/TutorialsWindow.axaml.cs
2025-06-18 08:50:02 +02:00

108 lines
3.4 KiB
C#

using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using System.Collections.Generic;
namespace AquaCare.View
{
public partial class TutorialsWindow : Window
{
private List<string> _images;
private int _currentImageIndex;
private TextBlock _imageIndexTextBlock;
public TutorialsWindow()
{
InitializeComponent();
_images = new List<string>();
_imageIndexTextBlock = this.Find<TextBlock>("imageIndexTextBlock");
InitializeTutorial();
}
private void InitializeTutorial()
{
_images = new List<string>
{
"Ressourcen/BilderTutorials/Beispiele/1.jpg",
"Ressourcen/BilderTutorials/Beispiele/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg"
};
_currentImageIndex = 0;
UpdateTutorialContent();
}
private void UpdateTutorialContent()
{
if (_images.Count > 0 && _currentImageIndex >= 0 && _currentImageIndex < _images.Count)
{
tutorialImage.Source = new Bitmap(_images[_currentImageIndex]);
_imageIndexTextBlock.Text = $"Bild {_currentImageIndex + 1} von {_images.Count}";
}
}
private void PreviousImageClick(object? sender, RoutedEventArgs e)
{
if (_currentImageIndex > 0)
{
_currentImageIndex--;
}
else
{
// Wenn wir beim ersten Bild sind, zum letzten springen
_currentImageIndex = _images.Count - 1;
}
UpdateTutorialContent();
}
private void NextImageClick(object? sender, RoutedEventArgs e)
{
if (_currentImageIndex < _images.Count - 1)
{
_currentImageIndex++;
}
else
{
// Wenn wir beim letzten Bild sind, zurück zum ersten springen
_currentImageIndex = 0;
}
UpdateTutorialContent();
}
private void FischeFütternClick(object? sender, RoutedEventArgs e)
{
_images = new List<string>
{
"Ressourcen/BilderTutorials/Beispiele/1.jpg",
"Ressourcen/BilderTutorials/Beispiele/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg"
};
_currentImageIndex = 0;
UpdateTutorialContent();
}
private void WasserWechselnClick(object? sender, RoutedEventArgs e)
{
_images = new List<string>
{
"Ressourcen/BilderTutorials/Beispiele/1.jpg",
"Ressourcen/BilderTutorials/Beispiele/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg"
};
_currentImageIndex = 0;
UpdateTutorialContent();
}
private void FilterReinigenClick(object? sender, RoutedEventArgs e)
{
_images = new List<string>
{
"Ressourcen/BilderTutorials/Beispiele/1.jpg",
"Ressourcen/BilderTutorials/Beispiele/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg"
};
_currentImageIndex = 0;
UpdateTutorialContent();
}
}
}