ProgaOra/20241024/WpfApp2/WpfApp2/MainWindow.xaml.cs
2024-10-24 10:20:01 +02:00

70 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
namespace WpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
asd.Add(0);
asd.Add(1);
asd.Add(2);
Kepmegjelenites(currentIndex);
}
int currentIndex = 0;
public static List<int> asd = new List<int>();
private void bal_Click(object sender, RoutedEventArgs e)
{
if (currentIndex == 0)
{
currentIndex = asd.Count - 1;
}
else
{
currentIndex--;
}
Kepmegjelenites(currentIndex);
}
private void jobb_Click(object sender, RoutedEventArgs e)
{
if (currentIndex == asd.Count - 1)
{
currentIndex = 0;
} else
{
currentIndex++;
}
Kepmegjelenites(currentIndex);
}
public void Kepmegjelenites(int index)
{
MyImage.Source = new BitmapImage(new Uri(@"images/" + index + ".jpg", UriKind.Relative));
}
}
}