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

@@ -45,6 +45,12 @@
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<CheckBox Content="112x112" Margin="10"/>
<CheckBox Content="500x500" Margin="10"/>
<CheckBox Content="1000x1000" Margin="10"/>
</StackPanel>
<Button
Content="Resize"
Padding="5"

View File

@@ -17,24 +17,44 @@ public partial class MainWindow : Window
InitializeComponent();
_mainViewModel = viewModel;
DataContext = _mainViewModel;
}
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog fileDialog = new OpenFileDialog
try
{
Filter = "GIF files (*.gif)|*.gif|All files (*.*)|*.*",
Title = "Select a GIF file"
};
OpenFileDialog fileDialog = new OpenFileDialog
{
Title = "Select a GIF file",
Filter = "GIF files (*.gif)|*.gif|All files (*.*)|*.*"
};
if (fileDialog.ShowDialog() == true)
if (fileDialog.ShowDialog() == true)
{
_mainViewModel.FilePath = fileDialog.FileName;
}
}
catch (Exception ex)
{
_mainViewModel.FilePath = fileDialog.FileName;
DisplayErrorMessage("An error occured while selecting the GIF file: " + ex.Message);
}
}
private void ResizeButton_Click(object sender, RoutedEventArgs e)
{
try
{
_mainViewModel.ResizeGif(128,128);
}
catch (Exception ex)
{
DisplayErrorMessage("An error occured while resizing the GIF: " + ex.Message);
}
}
private void DisplayErrorMessage(string message)
{
MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}