Implemented core logic

This commit is contained in:
Laurent
2026-02-17 00:05:24 +01:00
parent be6de65f85
commit 77d33e4c8f
7 changed files with 111 additions and 14 deletions

View File

@@ -1,17 +1,20 @@
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using GifResizer.Models;
using GifResizer.Service;
namespace GifResizer.ViewModels;
public class MainViewModel : INotifyPropertyChanged
{
private readonly ResizeService _resizeService;
public event PropertyChangedEventHandler? PropertyChanged;
public MainViewModel()
public MainViewModel(ResizeService service)
{
_resizeService = service;
FilePath = Directory.GetCurrentDirectory();
}
@@ -21,6 +24,11 @@ public class MainViewModel : INotifyPropertyChanged
get;
set => SetField(ref field, value);
}
public void ResizeGif(int width, int height)
{
_resizeService.ResizeGif(FilePath, width, height);
}
private bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{