You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KinectExercise_FrancoBroda/PenaltyMaster3000/ViewModel/MainVM.cs

41 lines
1.1 KiB

using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
namespace PenaltyMaster3000.ViewModel
{
public class MainVM : ObservableObject
{
private DispatcherTimer timer = new DispatcherTimer();
private bool image1Active = true;
public BitmapImage CurrentImageSource
{
get
{
string imagePath = image1Active ? "/Images/goalkeeper_starting1.png" : "/Images/goalkeeper_starting2.png";
return new BitmapImage(new Uri(imagePath, UriKind.Relative));
}
}
public MainVM()
{
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
}
private void Timer_Tick(object sender, EventArgs e)
{
image1Active = !image1Active;
OnPropertyChanged(nameof(CurrentImageSource));
}
}
}