using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using static System.Net.Mime.MediaTypeNames;

namespace _2024._10._24_Feladat2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private List<string> items = ["lion.jpg", "owl.jpg", "fox.jpg"];
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Elozo_Click(object sender, RoutedEventArgs e)
        {
            if (Kepek.Source is BitmapImage bitmapImage)
            {
                string fileName = System.IO.Path.GetFileName(bitmapImage.UriSource.LocalPath);
                int index = items.IndexOf(fileName);
                if (index - 1 < 0)
                {
                    index = items.Count;
                }

                BitmapImage newImage = new BitmapImage();
                newImage.BeginInit();
                newImage.UriSource = new Uri($"E:/Suli/13.b/Programozás (Tusjak Brigitta)/Gyakorlat/Órai/2024. 10. 24_Feladat2/2024. 10. 24_Feladat2/{items[index - 1]}", UriKind.Absolute);
                newImage.EndInit();

                Kepek.Source = newImage;
            }
        }

        private void Kovetkezo_Click(object sender, RoutedEventArgs e)
        {
            if (Kepek.Source is BitmapImage bitmapImage)
            {
                string fileName = System.IO.Path.GetFileName(bitmapImage.UriSource.LocalPath);
                int index = items.IndexOf(fileName);
                if (index + 1 == items.Count)
                {
                    index = -1;
                }

                BitmapImage newImage = new BitmapImage();
                newImage.BeginInit();
                newImage.UriSource = new Uri($"E:/Suli/13.b/Programozás (Tusjak Brigitta)/Gyakorlat/Órai/2024. 10. 24_Feladat2/2024. 10. 24_Feladat2/{items[index + 1]}", UriKind.Absolute);
                newImage.EndInit();

                Kepek.Source = newImage;
            }
        }
    }
}