Tutorials Fenster fertig (ohne bilder)

This commit is contained in:
Tikkinger 2025-06-18 09:57:10 +02:00
parent 1d73b8607b
commit ccbbf1f991
63 changed files with 99 additions and 89 deletions

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Controller")] [assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Controller")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+11383fc75a9f1f764ac2f8fef2dd8f2da0c7e2b8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f15ec9caf02f7612f79e2af762523e526c5e3015")]
[assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Controller")] [assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Controller")]
[assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Controller")] [assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Controller")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@ -1 +1 @@
b26810a9701a80bd8d247c92ecf69824a86d42eff82b9218864ad2356c15c28a 4a1595911e8564a3ee44d1afa12534ecbbd538005c0e2dc8381ae13ac848a00b

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Model")] [assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+11383fc75a9f1f764ac2f8fef2dd8f2da0c7e2b8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f15ec9caf02f7612f79e2af762523e526c5e3015")]
[assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Model")] [assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Model")] [assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@ -1 +1 @@
1f8bedf408b8f59454ecc9fe6bdd5c389ea72f6f52e0c888b1f255e3586460ec 608884560f9ff9dcf53b06872b5959ce6fdcecbed088fdb17cc4e5a296ea6109

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Persistence")] [assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.Persistence")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+11383fc75a9f1f764ac2f8fef2dd8f2da0c7e2b8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f15ec9caf02f7612f79e2af762523e526c5e3015")]
[assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Persistence")] [assembly: System.Reflection.AssemblyProductAttribute("AquaCare.Persistence")]
[assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Persistence")] [assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.Persistence")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@ -1 +1 @@
4b1690178df789d1c5fd4816cf36ec319f0ceb403af602830b6577406a3b49da 2be14979cabc9b5f0134f4360999b97b323362d004003e24c42ef7d64d8cf6ba

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 890 KiB

After

Width:  |  Height:  |  Size: 890 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -11,9 +11,9 @@
</Grid.Background> </Grid.Background>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- Überschrift --> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <!-- Buttons für Tutorials --> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <!-- Tutorial-Inhalt --> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Buttons für Tutorials --> <!-- Buttons für Tutorials -->
@ -21,7 +21,7 @@
Orientation="Horizontal" Orientation="Horizontal"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Margin="0,5,0,5"> Margin="0,5,0,0"> <!-- Unteres Margin reduziert -->
<Button Content="Fische füttern" Width="300" Height="50" Click="FischeFütternClick"/> <Button Content="Fische füttern" Width="300" Height="50" Click="FischeFütternClick"/>
<Button Content="Wasser wechseln" Width="300" Height="50" Click="WasserWechselnClick"/> <Button Content="Wasser wechseln" Width="300" Height="50" Click="WasserWechselnClick"/>
<Button Content="Filter reinigen" Width="300" Height="50" Click="FilterReinigenClick"/> <Button Content="Filter reinigen" Width="300" Height="50" Click="FilterReinigenClick"/>
@ -35,22 +35,38 @@
<!-- StackPanel für Tutorial-Inhalt --> <!-- StackPanel für Tutorial-Inhalt -->
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" Spacing="5"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Spacing="5">
<!-- Bild --> <!-- Container für Bild und initialen Text -->
<Image x:Name="tutorialImage" Height="500" Width="500" Stretch="Uniform"/> <Grid Height="450" Width="500" Margin="0,0,0,0"> <!-- Höhe reduziert -->
<Image x:Name="tutorialImage"
<!-- TextBlock für Bildindex --> Stretch="Uniform"
<TextBlock x:Name="imageIndexTextBlock" IsVisible="False"/>
Text="Bitte wählen Sie ein Tutorial aus" <TextBlock x:Name="initialText"
FontSize="24" Text="Wähle oben, was du nicht kannst!"
FontSize="30"
FontWeight="Bold" FontWeight="Bold"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Margin="0,10,0,10"/> VerticalAlignment="Center"/>
</Grid>
<!-- Bildindex-Text -->
<TextBlock x:Name="imageIndexTextBlock"
Text=""
FontSize="18"
HorizontalAlignment="Center"
Margin="0,2,0,2"/> <!-- Margins reduziert -->
<!-- Navigation unter dem Bild --> <!-- Navigation unter dem Bild -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="2" Margin="0,5,0,0"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Spacing="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
<Button Content="Zurück" Click="PreviousImageClick" /> <Button Content="Zurück" Click="PreviousImageClick" />
<Button Content="Weiter" Click="NextImageClick" /> <Button Content="Weiter" Click="NextImageClick" />
</StackPanel> </StackPanel>
<Button Content="Schließen"
Click="CloseClick"
Width="200"
Margin="0,5,0,0"
HorizontalAlignment="Center"/>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@ -2,106 +2,100 @@ using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using System.Collections.Generic; using System.Collections.Generic;
using System;
namespace AquaCare.View namespace AquaCare.View
{ {
public partial class TutorialsWindow : Window public partial class TutorialsWindow : Window
{ {
private List<string> _images; private List<string> _images;
private TextBlock? _imageIndexTextBlock;
private TextBlock? _initialText;
private int _currentImageIndex; private int _currentImageIndex;
private TextBlock _imageIndexTextBlock;
public TutorialsWindow() public TutorialsWindow()
{ {
InitializeComponent(); InitializeComponent();
_images = new List<string>(); _images = new List<string>();
_imageIndexTextBlock = this.Find<TextBlock>("imageIndexTextBlock");
InitializeTutorial(); _imageIndexTextBlock = this.Find<TextBlock>("imageIndexTextBlock")
?? throw new InvalidOperationException("imageIndexTextBlock not found");
_initialText = this.Find<TextBlock>("initialText")
?? throw new InvalidOperationException("initialText not found");
} }
private void InitializeTutorial() private void LoadTutorialImages(string folderName)
{ {
if (_initialText == null || tutorialImage == null) return;
_images = new List<string> _images = new List<string>
{ {
"Ressourcen/BilderTutorials/Beispiele/1.jpg", $"Ressourcen/BilderTutorials/{folderName}/1.jpg",
"Ressourcen/BilderTutorials/Beispiele/2.jpg", $"Ressourcen/BilderTutorials/{folderName}/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg" $"Ressourcen/BilderTutorials/{folderName}/3.jpg"
}; };
_currentImageIndex = 0; _currentImageIndex = 0;
_initialText.IsVisible = false;
tutorialImage.IsVisible = true;
UpdateTutorialContent(); UpdateTutorialContent();
} }
private void UpdateTutorialContent() private void UpdateTutorialContent()
{ {
try
{
if (_imageIndexTextBlock == null || _initialText == null || tutorialImage == null) return;
if (_images.Count > 0 && _currentImageIndex >= 0 && _currentImageIndex < _images.Count) if (_images.Count > 0 && _currentImageIndex >= 0 && _currentImageIndex < _images.Count)
{ {
tutorialImage.Source = new Bitmap(_images[_currentImageIndex]); string fullPath = $"avares://AquaCare.View/{_images[_currentImageIndex]}";
System.Diagnostics.Debug.WriteLine($"Lade Bild: {fullPath}"); // Debug-Ausgabe
var uri = new Uri(fullPath);
var asset = Avalonia.Platform.AssetLoader.Open(uri);
tutorialImage.Source = new Bitmap(asset);
_imageIndexTextBlock.Text = $"Bild {_currentImageIndex + 1} von {_images.Count}"; _imageIndexTextBlock.Text = $"Bild {_currentImageIndex + 1} von {_images.Count}";
_initialText.IsVisible = false;
tutorialImage.IsVisible = true;
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Fehler beim Laden des Bildes: {ex.Message}");
} }
} }
private void PreviousImageClick(object? sender, RoutedEventArgs e) private void NavigateImages(bool forward)
{ {
if (_currentImageIndex > 0) if (forward)
{ {
_currentImageIndex--; _currentImageIndex = _currentImageIndex < _images.Count - 1 ? _currentImageIndex + 1 : 0;
} }
else else
{ {
// Wenn wir beim ersten Bild sind, zum letzten springen _currentImageIndex = _currentImageIndex > 0 ? _currentImageIndex - 1 : _images.Count - 1;
_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(); UpdateTutorialContent();
} }
// Event Handler
private void FischeFütternClick(object? sender, RoutedEventArgs e) private void FischeFütternClick(object? sender, RoutedEventArgs e)
{ => LoadTutorialImages("Fische füttern");
_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) private void WasserWechselnClick(object? sender, RoutedEventArgs e)
{ => LoadTutorialImages("Wasser wechseln");
_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) private void FilterReinigenClick(object? sender, RoutedEventArgs e)
{ => LoadTutorialImages("Filter reinigen");
_images = new List<string>
{ private void NextImageClick(object? sender, RoutedEventArgs e)
"Ressourcen/BilderTutorials/Beispiele/1.jpg", => NavigateImages(true);
"Ressourcen/BilderTutorials/Beispiele/2.jpg",
"Ressourcen/BilderTutorials/Beispiele/3.jpg" private void PreviousImageClick(object? sender, RoutedEventArgs e)
}; => NavigateImages(false);
_currentImageIndex = 0;
UpdateTutorialContent(); private void CloseClick(object? sender, RoutedEventArgs e)
} => Close();
} }
} }

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.View")] [assembly: System.Reflection.AssemblyCompanyAttribute("AquaCare.View")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+11383fc75a9f1f764ac2f8fef2dd8f2da0c7e2b8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f15ec9caf02f7612f79e2af762523e526c5e3015")]
[assembly: System.Reflection.AssemblyProductAttribute("AquaCare.View")] [assembly: System.Reflection.AssemblyProductAttribute("AquaCare.View")]
[assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.View")] [assembly: System.Reflection.AssemblyTitleAttribute("AquaCare.View")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@ -1 +1 @@
8a14db02d022de50302e5b23ec47b97276b170631ab2e0c8f66201348cd0502c e30ebb268403392e58bc9de1b5c5f1a317f52bde0ea2d8405683bfbaf7f4e4a8

View File

@ -1 +1 @@
568de61c09a2d71f5b614d8e24749c223f330b05f9d54bd9ed27f337473a5bde 711c45fe3adfd872828a1b3d32c232c6b2f78f36b5d6719fd9e24857a1ff86c8