AquaCare/AquaCare.View/TutorialsWindow.axaml.cs
2025-05-06 22:58:57 +02:00

57 lines
1.7 KiB
C#

using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using LibVLCSharp.Shared;
namespace AquaCare.View
{
public partial class TutorialsWindow : Window
{
private LibVLC _libVLC;
private MediaPlayer _mediaPlayer;
public TutorialsWindow()
{
InitializeComponent();
// Pfad zu den LibVLC-Plugins angeben
var libvlcOptions = new[] { "--plugin-path=Ressourcen/LibVLC/plugins" };
// LibVLC initialisieren
_libVLC = new LibVLC(libvlcOptions);
_mediaPlayer = new MediaPlayer(_libVLC);
// MediaPlayer mit VideoView verbinden
videoView.MediaPlayer = _mediaPlayer;
// Event für Fensteröffnung
this.Opened += (sender, e) => OnWindowOpened(sender, e);
}
private void OnWindowOpened(object sender, EventArgs e)
{
videoView.IsVisible = true;
}
private void FischeFütternClick(object? sender, RoutedEventArgs e)
{
tutorialContentTextBlock.Text = "Inhalt des Tutorials 1: Dies ist ein Beispieltext für das erste Tutorial.";
}
private void WasserWechselnClick(object sender, RoutedEventArgs e)
{
// Video anzeigen
videoView.IsVisible = true;
// Video abspielen
var media = new Media(_libVLC, "avares://AquaCare.View/Ressourcen/Videos/WasserwechselVideo.mp4", FromType.FromPath);
_mediaPlayer.Play(media);
}
private void FilterReinigenClick(object? sender, RoutedEventArgs e)
{
tutorialContentTextBlock.Text = "Inhalt des Tutorials 3: Dies ist der Text für das dritte Tutorial.";
}
}
}