Added main structure

This commit is contained in:
Laurent
2026-02-16 22:44:44 +01:00
parent 663302c5b1
commit be6de65f85
10 changed files with 176 additions and 37 deletions

View File

@@ -0,0 +1,37 @@
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
namespace GifResizer.ViewModels;
public class MainViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public MainViewModel()
{
FilePath = Directory.GetCurrentDirectory();
}
public string FilePath
{
get;
set => SetField(ref field, value);
}
private bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(propertyName);
return true;
}
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}