Implemented core logic
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user