private void Button_Ignore_Click(object sender, RoutedEventArgs e) { var messagebox = new HedgeMessageBox("Save Current Palette?", "Do you want to try save your current palette\n" + "as a backup before contining/exiting?\n\n" + "This will not work if ManiaPal crashed while saving!"); messagebox.AddButton("Save Palette", () => { try { var MP = MainWindow.Instance; if (MP.LoadedFileType != null) { MP.LoadedFileType.filePath += ".bak"; MP.LoadedFileType.Write(MP.LoadedFileType.filePath, MP.Palettes, MP.CurrentPaletteSet); return; } } catch { MessageBox.Show("Failed"); } messagebox.Close(); }); messagebox.AddButton("Don't Save", () => { messagebox.Close(); }); messagebox.ShowDialog(); Close(); }
private void UI_SelectAnimationPath_Click(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog(); ofd.Filter = "Sonic Mania Animation|*.bin"; if (ofd.ShowDialog() == true) { UI_FilePathTextBox.Text = ofd.FileName; try { // Prepare the viewer SpriteView.Setup(ofd.FileName); } catch { // Clear viewer if failed SpriteView.Setup(null); // Display error var messageBox = new HedgeMessageBox("Failed to load animation!", "ManiaPal failed to parse the selected file.\nMake sure you have selected the correct file."); messageBox.AddButton("OK", () => { messageBox.Close(); }); messageBox.ShowDialog(); return; } // Clean and fill the animation list UI_Animation.Items.Clear(); foreach (var animation in SpriteView.LoadedAnimation.Animations) { UI_Animation.Items.Add(animation); } FrameID = 0; FrameIDMax = 0; Update(); // Load the first animation if (UI_Animation.Items.Count != 0) { UI_Animation.SelectedIndex = 0; } } }