private void undoToolStripMenuItem_Click(object sender, EventArgs e) { if (undoRedoSystem.CanUndo()) { int previouslySelectedType = objectPalette.SelectedIndex; ProgramState programState = undoRedoSystem.Undo(); this.Project = programState.Project.Copy(); objectPalette.GameObjects = Project.Types; SelectType(previouslySelectedType); Refresh(); } }
private void RaiseKeyDown(KeyEventArgs e) { if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { if (e.Key == Key.Z) { UndoRedoSystem.Undo(); } else if (e.Key == Key.Y) { UndoRedoSystem.Redo(); } } }