Implemented gif exportation and added some style (again)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user