Implemented gif exportation and added some style (again)

This commit is contained in:
Laurent
2026-02-17 18:20:53 +01:00
parent b81d912cf4
commit 4a5bf8dfff
10 changed files with 268 additions and 101 deletions

View File

@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Input;
using GifResizer.ViewModels;
using Microsoft.Win32;
@@ -31,21 +32,21 @@ public partial class MainWindow : Window
if (fileDialog.ShowDialog() == true)
{
_mainViewModel.FilePath = fileDialog.FileName;
_mainViewModel.LoadGifData(fileDialog.FileName);
}
}
}
catch (Exception ex)
{
DisplayErrorMessage("An error occured while selecting the GIF file: " + ex.Message);
}
}
private void ResizeButton_Click(object sender, RoutedEventArgs e)
{
try
{
_mainViewModel.ResizeGif(128,128);
_mainViewModel.ResizeGif();
DisplaySuccessMessage("Resize successful!");
}
catch (Exception ex)
{
@@ -53,8 +54,18 @@ public partial class MainWindow : Window
}
}
private void IntegerOnly(object sender, TextCompositionEventArgs e)
{
e.Handled = !int.TryParse(e.Text, out _);
}
private void DisplayErrorMessage(string message)
{
MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
private void DisplaySuccessMessage(string message)
{
MessageBox.Show(message, "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
}