private void loadBtn_Click(object sender, RoutedEventArgs e) { if (_hasChanges) { var result = MessageBox.Show("Warning!", "You have unsaved changes. Would you like to save them first?", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { saveBtn_Click(sender, e); } if (result == MessageBoxResult.Cancel) { return; } } var dlg = new OpenFileDialog(); dlg.Filter = "MP Tanks Sprite sheets (*.ssjson)|*.ssjson"; dlg.ShowDialog(); var path = dlg.FileName; if (path == null || !File.Exists(path)) { MessageBox.Show("Error", "Could not load the selected file"); return; //Couldn't load } try { ClearSheet(); _sheet = RuntimeSpriteSheet.LoadWithImage(File.ReadAllBytes(path)); _outFile = path; ReloadSheet(); } catch { MessageBox.Show("Something's wrong with the file you chose; we couldn't load it."); return; } }